Okay, so, Jens asked me to make a Church numeral project.
Lambda calculus, the ultimate source of the λ in the Snap! logo, is a branch of mathematics that describes an abstract computer that only has the features and . It turns out that that's all you need to build up to all the standard functions you expect in a programming language, and in particular, the arithmetic operators.
Church numerals are a representation of the nonnegative integers in lambda calculus. This handout and this starter project are all you need if you want to try it. I figure you lot can find any bugs in it before Jens uses it in public. :~)
(Why would you want to program with your hands tied behind your back like this? You wouldn't, not for practical programming, but it's a great environment for proving theorems about what computers can do, e.g., that some functions are uncomputable.)
Here you mentioned that some slight change was needed in how upvars are "scoped" (can I say so, is it grammaticaly correct?) in order for this project to work.
He didn't. In the handout there's a big complicated explanation of why if-then-else has to be implemented as a regular Snap! procedure rather than a naked gray ring. In the version I want to build, the project has its own evaluator using normal order, so if-then-else doesn't have to be a special case.
If you look at all the examples in the project, a bunch of formal parameters come up repeatedly: NUMBER, X, F, etc. I need to be able to have two lambda expressions in the same script, each of which has its own version of its formal parameters.
quick question what kind of functions are we doing with le numerals(i haven't been on in about 4 months so i'm more than useless actually,but i'd like to at least try)
Would it be reasonable for Church Integers to convert between the two representations of an integer i as (n, m) where i = n - m (which plays nicer with addition and subtraction) and (sign, n) (which plays nicer with multiplication and division), just as Snap! converts between Arrays and Linked Lists?
Umm, sure, you could invent whatever representation you want. Not sure you can call them "Church numerals" if you don't do it the way Alonzo Church did it... :~D