Mercurial > repo
diff interps/lambda/README @ 996:859f9b4339e6
<Gregor> tar xf egobot.tar.xz
author | HackBot |
---|---|
date | Sun, 09 Dec 2012 19:30:08 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interps/lambda/README Sun Dec 09 19:30:08 2012 +0000 @@ -0,0 +1,41 @@ +Lambda calculus interpreter +(c) Nikita Ayzikovsky, 2006 + +Usage: + +run lambda.py, which reads a single-line lambda calculus program from stdin. + +Syntax: + +A program can optionally contain any number of definitions, followed by +an expression. + +Definitions are of the form + + name = expression ; + +Expressions are standard lambda calculus expressions, with the symbol lambda +denoted by \. E.g. + + \x,y,z.(x (z y)) + +Don't forget to surround with brackets anything that ought to be surrounded +with brackets (any lambda body where something gets applied to something else) +"\x,y.x y" is an application of \x,y.x to y; but "\x,y.(x y)" is a single function +of two variables. + +IO: + +Input is not implemented. +For output, an expression of the form "text", when evaluated, prints 'text' +and evaluates to the identity function. +#show is a special function that evaluates its argument, and prints out +the result before returning it. +#list is a special expression that, when evaluated, prints the list of all +definitions. + + +DEFINITIONS: + +Definitions ('name = exp;') are persistent between program runs. To get +rid of all definitions, remove the file defs.pickle.