Lambda Calculus?

Extending or modifying the GP system itself (advanced!)

Moderator: MSandro

Post Reply
User avatar
Calloway
Posts: 100
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Lambda Calculus?

Post by Calloway » Sep 29th, '18, 15:15

This request is a bit of a long shot, but would it be possible to implement Lambda calculus and fully implement first-class functions?

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Lambda Calculus?

Post by JohnM » Jun 3rd, '19, 13:48

GP doesn't have closures, but it does have first-class functions. It also has "Action" objects. An Action is a sort of "explicit lambda" -- a way to bundle up a set of variable bindings in a closure-like object that can evaluated.

Omitting closures was an explicit design choice made for didactic reasons. Many modern languages, such as Javascript, make extensive use of closures, but they are far from simple or welcoming to beginners. I wanted GP to be a sort of transition from Scratch (which doesn't even have first-class functions) to Snap!/Scheme/Javascript/Smalltalk, which all make extensive use of closures. Although I've gotten pushback on that, including from my own team, I still think it's an interesting point in the design space of programing languages for non-experts that is worth exploring. Unfortunately, since GP has never been widely used, the jury is still out on whether GP's Actions are easier to learn or teach than full closures.

My advice for those who want to explore closures in a blocks language is to try Snap! The Snap! team has put a lot of thought into how to integrate closures into a blocks language and how to teach them. (I suspect you already use Snap!, so this is advice for other GP Forum readers.)

Post Reply