Comment by rmunn

5 hours ago

> I think Snap! could take advantage of its equivalency with Scheme, and you could just parse Scheme into Snap! blocks, and the other way around. And ChatGPT knows scheme pretty well, though it's not as ubiquitous and standard as JavaScript.

There's already a right-click menu option called "Lisp code". Take the "turn left 15 degrees" block (the "15" is the default value but of course it's a parameter that can be set to anything), drag it out into the editor, and right-click the block. Choose "Lisp code" and `(left 15)` will be displayed in a results bubble; you can then right-click the results bubble and export it to a file or copy it to the clipboard. If you have two blocks put together then the resulting Lisp code looks like this:

    (
        (left 15) 
        (move 10)
    )

I haven't checked recently to see if they have finished the other half of that feature, the parse-Lisp-into-blocks half. But I know they want it to be in there; I forget what its status was last time I checked.

You can use the split and join blocks to get the code and turn it back into blocks, but it's not well documented like I mentioned earlier. You split a ringified script "by blocks" to get a list version, which you can then use the "[text] of [list]" block (it's the one with length selected by default in the dropdown). That allows you to get the "Lisp" version in code.

Once you have the text version, you put it back into a split block set to split "by blocks", which gets the list version, which can then be put into the input list of a join block to get the code again.

This is technically discoverable from within Snap itself since they provide a library wrapping these steps, but it's not the first place you might look if you don't know it already exists.