When people encounter Lisp syntax for the first time
-
This post did not contain any content.
-
This post did not contain any content.
Where does that notation work?
-
Where does that notation work?
In c style languages, Java, c++, rust, etc.
-
Where does that notation work?
Lisp uses it, with the fun extra part that operators are just normal functions - so instead of
foo(bar)
you get(foo bar)
, or for operators1+1+2
becomes(+ 1 1 2)
. It’s a really fun language even just for being different than most, I def recommend playing around with it if you’re looking for something new. -
This post did not contain any content.
What about the M-expression version (f[x])?
-
In c style languages, Java, c++, rust, etc.
surely you mean Algol style languages?
-
surely you mean Algol style languages?
I did, but I couldn’t remember it. so thanks!
-
Lisp uses it, with the fun extra part that operators are just normal functions - so instead of
foo(bar)
you get(foo bar)
, or for operators1+1+2
becomes(+ 1 1 2)
. It’s a really fun language even just for being different than most, I def recommend playing around with it if you’re looking for something new.The fun part comes from using it without syntax highlighting, so you can regularly play „find the missing paranthesis“.
-
The fun part comes from using it without syntax highlighting, so you can regularly play „find the missing paranthesis“.
My lisp days were back in my “IDEs are bloat” phase so that’s the only way I ever interacted with it lmao
-
Where does that notation work?
(f x)
works this way in Lisp - as in the joke - and Lisp descendants like Scheme. And then there’s Haskell which takes the whole thing a step further still.Also Perl, because Larry thought it would be fun(ctional). The external parentheses are technically optional in this case, but won’t break anything if included. Regular
f(x)
syntax is also supported there. (You could probably remake this meme with Python and Perl in first and second panels tbh.)And I know of at least one dialect of BASIC that allowed subroutine calls to lack their parentheses, so the same external parentheses thing would apply if that subroutine was a function.
-
What about the M-expression version (f[x])?
AFAIK, the only language that ever implemented M-expressions was Logo.
-
This post did not contain any content.
WDYM “the 1st time”?
-
Lisp uses it, with the fun extra part that operators are just normal functions - so instead of
foo(bar)
you get(foo bar)
, or for operators1+1+2
becomes(+ 1 1 2)
. It’s a really fun language even just for being different than most, I def recommend playing around with it if you’re looking for something new.The most interesting part about Lisp is homoiconicity:
(+ 1 1 2) is literally a list with symbol “+” and 3 numbers.
Which allows to build the most powerful macro possible, manipulating code (with data as a tree-like structures) and changing it into whatever else at compile time.
Now if only there was any good use for macros, this would be the best language
-
This post did not contain any content.
Does that make Lisp a language with significant white space?
-
The most interesting part about Lisp is homoiconicity:
(+ 1 1 2) is literally a list with symbol “+” and 3 numbers.
Which allows to build the most powerful macro possible, manipulating code (with data as a tree-like structures) and changing it into whatever else at compile time.
Now if only there was any good use for macros, this would be the best language
Threading is a great case for a macro.
(-> x (* 2) (/ 3) (- 1))
Is the same as
(- (/ (* x 2) 3) 1)
-
And then there’s Haskell which takes the whole thing a step further still.
Wait, what works in Haskell that doesn’t in Lisp, exactly? Are the spaces not just function composition?
-
Threading is a great case for a macro.
(-> x (* 2) (/ 3) (- 1))
Is the same as
(- (/ (* x 2) 3) 1)
Sure it’s not like it has no uses, but it’s something languages have built-in as syntax sugar or operators, and you rarely need to built your own macro for anything.
-
The fun part comes from using it without syntax highlighting, so you can regularly play „find the missing paranthesis“.
Editing lisp with ed is the best way to learn it.
-
Sure it’s not like it has no uses, but it’s something languages have built-in as syntax sugar or operators, and you rarely need to built your own macro for anything.
Have you ever used a domain specific language? My intuition says, “no.”
-
of at least one dialect of BASIC that allowed subroutine calls to lack their parentheses
Did sub calls normally have parentheses in BASIC?