Page 1 of 1

Allow used to create their own control structures

Posted: Jul 30th, '16, 05:32
by MrSteve
So I saw a demo by Jens where he should how you could modify the While loop in Snap (way cool).

Right now it seems the Control blocks are primitives, so can't currently modify them. But if we had something where users could modify the control structures they could create their own Steppers and Etoys like 'ticks per second' scripts

Re: Allow used to create their own control structures

Posted: Aug 1st, '16, 15:46
by JohnM
I consciously decided to NOT support user-defined control structures in GP to keep the floor low. I am mostly alone in my belief that adding lexically-scoped closures -- the tool that makes user-defined control structures possible in Snap (as well as LISP, Scheme, and Smalltalk) -- to GP would "raise the floor" significantly; Jens and Yoshiki disagree.

That said, even without closures you can do powerful and interesting things in GP with functions. For example, you can implement "map" and "filter" or parameterize sorting using a custom comparison function. GP also has "action" objects that combine a function with a set of pre-bound arguments. If those things interest you, you might explore the "Functions" category of the palette.

Of course, Snap is a great place to explore user-defined control structures, continuations, up-vars, and many other wonders of programming language implementation. GP doesn't need to do everything...

Re: Allow used to create their own control structures

Posted: Aug 1st, '16, 17:18
by MrSteve
Agree "GP doesn't need to do everything..."

I also know myself and hope I am not making too many requests/comments. I realize this is pre-alpha and you folks are doing a lot of great work. Thanks for all your time, patience and consideration.