Earlier quoted context omitted.
While ML was the meta language for a theorem prover. Funny how these were side effects.
And ML was originally written in Lisp. https://github.com/theoremprover-museum/LCF77/tree/master/sr... https://github.com/theoremprover-museum/HOL88/tree/master/sr...
The Idea of Lisp
41–50 of 348 posts
Re: The Idea of Lisp
#42The conditional expression or more specifically everything being an expression is my favorite thing about Lisp. I did not know that McCarthy pushed to add it to Algol which apparently today is the ternary operator for most languages. It is annoying that so many languages (C, Java, C#, etc) have both a conditional statement (if-else) and conditional expression (ternary ?:). Really the if-else should be an expression (…
It's been a while since I used Common Lisp but isn't it recommended to use "if" for conditional expressions and "when"/"unless" for conditional statements?
Re: The Idea of Lisp
#43https://github.com/rongarret/BWFP
Still very much a work in progress. Feedback appreciated.
Re: The Idea of Lisp
#44The conditional expression or more specifically everything being an expression is my favorite thing about Lisp. I did not know that McCarthy pushed to add it to Algol which apparently today is the ternary operator for most languages. It is annoying that so many languages (C, Java, C#, etc) have both a conditional statement (if-else) and conditional expression (ternary ?:). Really the if-else should be an expression (…
If you like everything being an expression, check out tcl. A lot of ideas from lisp show up in tcl, especially the idea of everything as an expression. Tcl embodies this idea while also having the look of an algol-like language. Funny it can pull this off while having basically no syntax.
let x = if something {
foo()
} else {
bar()
}
Things which don't have a logical value evaluate to `()` (the empty tuple), I believe.Re: The Idea of Lisp
#45Does anybody have a few examples of DSLs people make in a lisp (ideally clojure because I have worked with it a tad)? I've seen plenty of cases where people make a pseudo-dsl via optional arguments, but not seen this so-oft mentioned "yeah we just wrote a dsl for it because lisp" sort of deal.
Maxima CAS is implemented as a DSL on top of Common Lisp. It is one of the best environments for symbolic math (other than commercial products such as Mathematica).
Re: The Idea of Lisp
#46Lisp was developed because McCarthy needed a tool for experimenting with AI. Found a video of McCarthy talking about AI: https://www.youtube.com/watch?v=Ozipf13jRr4 And if anyone cares, here is nice Shirt with McCarthy on it ;) https://www.teepublic.com/t-shirt/666689-john-mccarthy-lisp-... I think it should be mandatory for CS students to implement their own little Lisp using the building blocks McCarthy described!…
Is there a kind of walkthrough/tutorial about how to develop a little Lisp interpreter? That sounds like a fun experiment. PS: Sorry, I am a Java OO developper. But I like to learn :)
[natives.label, factorial,
[natives.lambda, [n], [natives.cond,
[ [natives.eq, n, 0], 1 ],
[ true, [natives.times, n, [factorial, [natives.plus, n, -1]]] ]
]]
]
It took me about 5 hours to get the whole think working from his paper, and I learned a lot in the process.Re: The Idea of Lisp
#47Earlier quoted context omitted.
It's been a while since I used Common Lisp but isn't it recommended to use "if" for conditional expressions and "when"/"unless" for conditional statements?
It's a matter of code readability. "when" and "unless" are expressions too, but they look the best when they're used instead of "if" for single-branched conditionals when you don't care about return value.
Re: The Idea of Lisp
#48Earlier quoted context omitted.
If you like everything being an expression, check out tcl. A lot of ideas from lisp show up in tcl, especially the idea of everything as an expression. Tcl embodies this idea while also having the look of an algol-like language. Funny it can pull this off while having basically no syntax.
Rust also has (almost) everything being an expression - things like this aren't uncommon: let x = if something { foo() } else { bar() } Things which don't have a logical value evaluate to `()` (the empty tuple), I believe.
x = something ? foo() : bar();
Re: The Idea of Lisp
#49Earlier quoted context omitted.
Rust also has (almost) everything being an expression - things like this aren't uncommon: let x = if something { foo() } else { bar() } Things which don't have a logical value evaluate to `()` (the empty tuple), I believe.
The if expression is not a persuasive example. C/Java/Algol/etc all have it as well. x = something ? foo() : bar();
x = if(something) { a = foo(); baz(a); } else { b = bar(); baz(b); }
Re: The Idea of Lisp
#50I wonder why lisp isn't as popular as say python for AI, ML, and stuff. I see these fields as having a strong academic tone, and it feels like racket or clojure could be bigger when it comes to that.
Well, it was. Specifically, Common Lisp was. But that language's standard was etched in stone in 1994 whereas languages like Python (where most deep learning user-facing code is done) continue to evolve. I think Python really took off for that because it already had quality and widely-used libraries for writing the code in Python and doing the work in a more efficient place (numpy, scipy). Clojure has one of those fo…
This is an apples to oranges comparison. The Common Lisp standard hasn't been updated since 1994. The Python standard has not been written at all yet. Lisp and Python implementations both continue to evolve and be released.