Lambda Calculus
Check-in [391380a0ba]
Not logged in

 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 .. 41 42 43 44 45 46 47 48 49 50 51 52 53 ``` ```@pagedown # Lazp: An untyped, lazy Lambda Calculus with Macros and Primitives The goal, here, isn't to make something that's super fast; it's to provide a useable untyped, lazy, lambda calculus for people to use. To facilitate macros, Lazp uses abstract syntax trees, made from LC functions (i.e. like LISP): a b c -> _apply (_apply (_ref a) (_ref b)) (_ref c) 𝛌a . b -> _lambda a (_ref b) 𝜋x y z -> _prim x (_prim (_ref y) (_ref z)) -- call a primitive function x with arguments y and z Template Haskell demonstrates a perceived need for metaprogramming, even in a lazy language, like Haskell. Eval exposes the Lazp code-generator to developers which helps with creating external DSLs, among other things. ................................................................................ ## Parser (the parser should eventually be written in Lazp) \x . y is equivalent to 𝛌x . y Since \xxx\ has no meaning in Lazy, it seems like a good way to name character macros, if you don't want to use up "normal" identifiers in the name space. ## LISP-like syntax for Lazp (an alternate parser for curmudgeons) (lambda (a) b) -> (_lambda (a) (_ref b)) (a b c) -> (_apply (_ref a) (_ref b) (_ref c)) ``` ``` | | | ``` ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 .. 41 42 43 44 45 46 47 48 49 50 51 52 53 ``` ```@pagedown # Lazp: An untyped, lazy Lambda Calculus with Metaprogramming and Primitives The goal, here, isn't to make something that's super fast; it's to provide a useable untyped, lazy, lambda calculus for people to use. To facilitate metaprogramming, Lazp uses abstract syntax trees, made from LC functions (i.e. like LISP): a b c -> _apply (_apply (_ref a) (_ref b)) (_ref c) 𝛌a . b -> _lambda a (_ref b) 𝜋x y z -> _prim x (_prim (_ref y) (_ref z)) -- call a primitive function x with arguments y and z Template Haskell demonstrates a perceived need for metaprogramming, even in a lazy language, like Haskell. Eval exposes the Lazp code-generator to developers which helps with creating external DSLs, among other things. ................................................................................ ## Parser (the parser should eventually be written in Lazp) \x . y is equivalent to 𝛌x . y Since \xxx\ has no meaning in Lazy, it seems like a good way to name parser macros, if you don't want to use up "normal" identifiers in the name space. ## LISP-like syntax for Lazp (an alternate parser for curmudgeons) (lambda (a) b) -> (_lambda (a) (_ref b)) (a b c) -> (_apply (_ref a) (_ref b) (_ref c)) ```