4 ms·
LOGO is already Lisp without parentheses and with infix notation. Recently, doing exercises in LOGO with my kid,he asked: can we put some parentheses around the
by pgtan 7y ago
LOGO is already Lisp without parentheses and with infix notation. Recently, doing exercises in LOGO with my kid,he asked: can we put some parentheses around the functions for better clearness? I said: my son, you just discovered Lisp!
- wtetzner 7y agoHonu's real trick is supporting Racket's syntax-case in an infix syntax.
- drcode 7y agoI like the folks involved with Honu and new language initiatives are always great, but to me this reads as "Honu's real trick is supporting something I don't want, using something I don't want"
- wtetzner 7y agoWell, given that it's meant to be language research, I think there's a ton of value in it. We already have a bunch of popular existing languages with infix syntax, and Honu shows how a powerful hygienic macro system can be applied to those. You may not want a powerful macro system in those languages, but I personally think it would far preferable to the existing mess of annotations and build-system hacks to generate code.
- soegaard 7y agoThis needs an upvote.
- Rerarom 7y agoLisp parentheses are not just for grouping. In Lisp, x is not the same as (x). That confused me a lot at first because it's rarely explicitly stated.
- milhnl 7y agoCan you elaborate or maybe link to a resource that explains this? This seems to be missing piece of the puzzle for me.
- lgessler 7y agoOne is a function, one is a call to that function. I think this is just hard to grasp because in other languages there's often not occasion to use a function pointer. But compare these two code snippets in Python and Scheme: >>> def add_one(x): ... return x + 1 ... >>> add_one <function add_one at 0x7f7504bf2050> >>> add_one(1) 2 >>> list(map(add_one, [1,2,3])) [2, 3, 4] That's the same as: => (define (add-one x) (+ x 1)) add-one => add-one #[compound-procedure add-one] => (add-one 1) 2 1 ]=> (map add-one (list 1 2 3)) (2 3 4)
- nickloewen 7y agoWhen you put parentheses around an atom, lisp sees that as a function call. Say `x` is a function which adds one to a number. Say `y` is an atom which is not a function—perhaps a list: `(list 1 2 3)`. If you write just `x`, no parens, you point to the function without executing it. If you do this at your interpreter it will tell you that the value of `x` is “function something something.” This is important because it’s what makes it possible to pass functions as arguments, and write things like `(map x y)`. Here `x` is not evaluated in place; it’s called later by the `map` function, once for each element of the list, resulting in `(list 2 3 4)`. Now if you put parentheses around `x`, lisp will try to execute it on the spot. `(x 1)` is what other languages would call `x(1)`, and will return `2`. You have to be a little careful about this because it means that if you put parens around `y`, which isn’t a function, you’ll get an error. This is why lisp has the ‘quote’ operator, which means “take the next atom as literal data and don’t try to execute it.” So `(quote (1 2 3))` will return `(1 2 3)`. This can also be written `’(1 2 3)`—which is nice, because this is effectively equivalent to `(list 1 2 3)`, and could have saved me some typing when I defined `y` earlier. e: typo ; also, sorry for the ugly syntax, I forgot there was no inline code formatting on HN