Category:Lambdatalk: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 25: Line 25:
-> 2+3 is equal to 5
-> 2+3 is equal to 5


==B) {lambda talk}'s foundations==
==B) more about {lambda talk}==


{lambda talk} is freely inspired by the λ-calculus. At the lowest level a {lambda talk} expression is exclusively made of words, abstractions and applications:
{lambda talk} is freely inspired by the λ-calculus. At the lowest level a {lambda talk} expression is exclusively made of words, abstractions and applications:

=== structure & evaluation


expression is [word|abstraction|application]*
expression is [word|abstraction|application]*
Line 50: Line 52:


What can be done with so little?
What can be done with so little?

===Examples===


Hello World
Hello World
Line 91: Line 95:
{CAR {CONS Hello World}} -> World
{CAR {CONS Hello World}} -> World


===about the implementation===
===Implementation===


{lambda talk} is not implemented following the standard process, code -> tokens -> tree -> eval. '''The code is a string from beginning to end'''. At each keyboard input, the code is processed by a single function, do_eval(), which returns words sent to the browser for the final evaluation and display:
{lambda talk} is not implemented following the standard process, code -> tokens -> tree -> eval. '''The code is a string from beginning to end'''. At each keyboard input, the code is processed by a single function, do_eval(), which returns words sent to the browser for the final evaluation and display:
Line 114: Line 118:
- lambdas accept de facto '''partial function application''': called with a number of values lesser than its arity, a lambda memorizes the given values and returns a new lambda waiting for the rest.
- lambdas accept de facto '''partial function application''': called with a number of values lesser than its arity, a lambda memorizes the given values and returns a new lambda waiting for the rest.


===and?===
Upon these foundations, after '''Alonzo Church''', we could define the set of natural numbers [ZERO, ONE, TWO, ...] and their associate operators, [SUCC, ADD, MUL, POWER, PRED, ...] allowing to build iterations and recursions. For instance, computing factorials:

Upon these foundations, after '''Alonzo Church''', we could define the set of natural numbers [ZERO, ONE, TWO, ...] and their associate operators, [SUCC, ADD, MUL, POWER, PRED, ...] allowing to build '''iterations''' and ''recursions'''. For instance, computing factorials:


{CHURCH
{CHURCH