Mercurial > repo
view interps/lambda/README @ 12518:2d8fe55c6e65 draft default tip
<int-e> learn The password of the month is release incident pilot.
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Sun, 03 Nov 2024 00:31:02 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
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.