News for hackers. Stuff that matters.
Re:Logo and Learning (2015) by greenbit on Tuesday July 19, 2022 @10:50AM (#32152328)
The usual impression of LOGO is that it's all about the turtle, but as it happens, the language has a fair degree of Lisp-iness to it. Nothing like the Lisp macro system iirc, but it did lend itself to functional programming and recursive algorithms quite well.
Re:Logo and Learning (2015) by ianbicking on Tuesday July 19, 2022 @12:43PM (#32154380)
Given the nature of variables and blocks in Logo you can do quite a bit. Like say you want to do a modulo-like operation:

    IF :SIZE > 100 [MAKE "SIZE :SIZE - 100]
You could do:

    TO MODVAR :VARIABLE :AMOUNT
      IF THING :VARIABLE > :AMOUNT [MAKE :VARIABLE THING :VARIABLE - :AMOUNT]
    END
    MODVAR "SIZE 100
But even things like WHILE can be implemented:

    TO WHILE :COND :BLOCK
      IF :COND [EVAL :BLOCK WHILE :COND :BLOCK]
    END
And the blocks are just lists, so you could potentially rewrite them.

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.

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.

Re:Logo and Learning (2015) by xhevahir on Tuesday July 19, 2022 @02:02PM (#32155591)
I looked at a couple of math books several years ago that used Logo, and was quickly turned off by the fact that it didn't have first-class functions--a pretty big limitation for a lisp. I ended up translating the code to either Python or Racket.
Re:Logo and Learning (2015) by dtagames on Tuesday July 19, 2022 @01:13PM (#32154861)
Technically, it is a Lisp.
Re:Logo and Learning (2015) by retrocryptid on Tuesday July 19, 2022 @02:32PM (#32155974)
When I was a LOGO test subject as a kid in ths early 70s, we used various list & text manipulation features of LOGO to build sentence generators and parsers. It wasn't all about the turtle. Very LISPy stuff. IIRC, the machine we used might have been a modified early lisp machine.