Lambda Calculus Reducer

Out of boredom, I created a project that represents lambda calculus terms as list structures, and provides blocks for constructing, reducing and converting them to other forms.

https://snap.berkeley.edu/snap/snap.html#present:Username=rdococ&ProjectName=Lambda%20Calculus%20Reducer

As an example of what you can do, this is how you might use Snap! to construct the 'successor' function for Church numerals:

(Don't mind the control block =, that's just there so you can define variables within reporters. The new var block reports a new variable every time, which is why it's necessary here. You can still construct terms without it!)

Here is the resulting data structure, blockified for visibility:

Those numerical IDs are used to disambiguate between different variables with the same name.

You can convert lambda terms back into constructor blocks:

Calling the reported procedure reports back the original data structure.

You can convert terms into text:

You can convert them into working Snap! procedures, thanks to the new script-building capabilities of the join and split blocks:

This can be used to convert values into other Snap!-friendly forms, such as church numerals into Snap! numbers:

Oh, this is wonderful! Thank you so much for inventing it!

I've been trying to invent Church numerals this way:
https://snap.berkeley.edu/snap/snap.html#present:Username=bh&ProjectName=new-church-soln
but it doesn't work because I haven't yet convinced Jens to change the scope rules for upvars so that I can use the same name in two lambda expressions in the same toplevel script.

I'll have to see if I can preprocess my lambda expressions to use your idea of turning all the variable names into gensyms.

Edit: Uh oh, something in v7 has broken my project even worse, so I get no-such-variables errors. It worked better in v6, just getting wrong answers sometimes. I was confused.