by rmunn · 2mo ago · 0 comments
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.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.
Whether using text with LLMs in Snap! is actually a good idea is up for debate, but it is doable.