Re:Logo and Learning (2015)
by ianbicking on Tuesday July 19, 2022 @03:18PM
(#32156587)
Oops, while should be:
TO WHILE :COND :BLOCK
IF RUNRESULT :COND [RUN :BLOCK WHILE :COND :BLOCK]
END
But this does fail when you do some things in the block, like [OUTPUT] (equivalent of return).Also looking closer at UCBLogo macros and they are evaluated at runtime in a way I didn't expect. That is, they are expanded at call time, and can self-reference causing repeated expansions (but the expansions are immediately evaluated so the program size isn't effected). But I think they really could have accomplished the same thing more easily with the Tcl uplevel command.
I was looking at Berkeley Logo to remind myself of the commands, and found that CASE (similar to switch) is implemented as a macro: https://github.com/jrincayc/ucblogo-code/blob/26ae6f01105832... – though it seems like it could be implemented just fine as a regular function. Though :caseignoredp is confusing me a bit... it's technically a dynamically-scoped variable that affects many comparison operations, but that wouldn't work with a macro. I wonder if that's a bug from when it was converted from a normal function to a macro.