Re:Why is Common Lisp not the most popular programming langu...
by lispm on Thursday February 15, 2024 @02:09AM
(#39379921)
[ Parent
| on HN ]
Re:Why is Common Lisp not the most popular programming langu...
by erichocean on Thursday February 15, 2024 @02:07PM
(#39386987)
;; clojure
(defn sum-and-square [a b] (let [sum (+ a b)] (* sum sum)))
Honestly, I'm not sure what you're trying to show.
Re:Why is Common Lisp not the most popular programming langu...
by lispm on Thursday February 15, 2024 @02:29PM
(#39387335)
I'm not sure what you are trying to show? Code can be in one line? Okaaaaay...
I was trying to show that one can define local variables without adding another list level via let.
Like if one would/could write in Clojure:
(defn sum-and-square [a b &blah sum (+ a b)] (* sum sum))
Another Common Lisp example, we'll stick to your one liner format, using infix syntax via a reader macro: (defun sum-and-square (a b) #I(sum=a+b,sum*sum))
Before you ask: what am I trying to show? This shows that Common Lisp syntax can be deeply extended by the user and that this is a standard feature of the language. Want a shorter infix notation without s-expressions? Why not...