Implementing ADT with macros in Racket using Scott encoding

I was playing with a simple ML like grammar in the past weeks involving algebraic data types at the form data = ... | ... I got me asking myself if it would be possible to compile this to Scott encoding so that we have only functions at evaluation time. I will use option type as example here: data option = some x | none and match expressions as eliminators match x with | some x => x | none => 0 end . To make my life easier I decided to try this with Racket. If can define a macro e

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论