A Simple Case for Lisp Parenthesis
----------------------------------
Tue Nov 29 23:12:42 EST 2022
I was reading the Functions chapter of Crafting Interpreters
today and was struck by the ugliness of chained function
calls:
foo()()
This presumably calls `foo`, then calls the function foo
returns.
While it is arguable that it's maybe too subtle, the lisp
equivalent is definitely easier on the eyes:
((foo))
Of course, the real power of lisp parenthesis is the fact that
by reducing the syntax to.. a lack of syntax (code is data),
it's easy to write metaprograms (code that writes code
(also called macros)).
But I think sometimes it's easier to appeal to aesthetics than
power. Which would you prefer?
bar(foo(1, 2)(5), baz(2))(5)
((bar ((foo 1 2) 5) (baz 2)) 5)
Or even better:
((bar ((foo 1 2) 5)
(baz 2))
5)
Maybe I've just been reading too many books on Scheme :)