Beep boop at flatMap
Post that goes with flatMap(Oslo) talk Lambda Calculus Beep Boop.
Various beep boop evaluators. Maybe they work in some of the browsers. The later ones are more fun...
- Beop. Only shows the beep-boops.
- Bru. Also shows De Bruijn index expressions.
- Lamb. Also shows more regular lambda expressions.
- Eval. Also shows “next expression” when an expression can be reduced.
- Sounds. Also makes sounds when pressing buttons.
- Playback. Also makes sounds when the expression is finished, and automatically does a step of evaluation after playing sounds.
- Rectangles. Also draws coloured rectangles.
- Only rectangles. Like the “rectangles” one, but shows only the rectangles when the expression is finished/being evaluated.
- Fish. Like the “rectangles” one but with fish.
- Only fish. Like the “only rectangles” one but with fish.
- A does beep.
- S does boop.
- D does bap.
- F does pling.
- Backspace takes removes the latest/rightmost word (beep/boop/bap/pling) from current expression.
- Space does a step of evaluation, if the expression is finished and can be reduced. (Unnecessary with the “playback” evaluator and later ones, as they kind of automatically evluate.)
- Beep introduces a lambda. After a beep you have to write the body of the lambda.
- Some boops and then a bap is a variable reference. Boop bap is 1, boop boop bap is 2, and so on. (The numbers work like De Bruijn indices.)
- Pling does function application. After a pling you have to write the function and then after that the argument.
So the identity function is beep boop bap (A S D). The Church encoded number one is beep beep pling boop boop bap boop bap (A A F S S D S D). Stuff like that.
A fancy exprssion, like a “2 + 3” one, can be written like so:
F F A A A A F F S S S S D S S D F F S S S D S S D S D A A F S S D F S S D S D A A F S S D F S S D F S S D S D
[pling, pling, beep, beep, beep, beep, pling, pling, boop, boop, boop, boop, bap, boop, boop, bap, pling, pling, boop, boop, boop, bap, boop, boop, bap, boop, bap, beep, beep, pling, boop, boop, bap, pling, boop, boop, bap, boop, bap, beep, beep, pling, boop, boop, bap, pling, boop, boop, bap, pling, boop, boop, bap, boop, bap].forEach(doBeop);