5 ms·
> no ecosystem Today it is possible to run Clojure on: JVM, JS, BEAM, .NET CLR, Common Lisp runtimes; Have interop with Python and R. There are Clojure-like
by iLemming 7y ago
> no ecosystem
Today it is possible to run Clojure on:
JVM, JS, BEAM, .NET CLR, Common Lisp runtimes;
Have interop with Python and R. There are Clojure-like Lisp dialects that can compile to Lua and C.
> you don't need the Clojure repl
If you never have experienced the joy of using "true" REPL, you will never understand the immense value of it. Non-lispy languages, sadly have no "true" REPLs.
- fiddlerwoaroof 7y agoJavaScript could have one: see the indium plugin for emacs/chrome. The issue in js is that webpack and related build tooling does a really good job of making a repl impossible.
- iLemming 7y ago> JavaScript could have one No, it is still would be very crippled imitation of REPL, merely interactive environment. For a language to have a fully-functional REPL, it is required to have at least some homoiconicity, which JS is not. Let me demonstrate: ReactDOM.render( <h1>Hello, world!</h1>, document.getElementById('root') ); Can you evaluate that in JS REPL? Can you evaluate any part of it? Now, let's naively "convert" that into Clojurescript: (ReactDOM.render [:h1 "Hello, world!"] (document.getElementById "root")) You can evaluate every single part of it. You can evaluate "Hello, world!" string; [:h1 ...] vector; document.getElementById function, all these are valid Clojure expressions. In addition to that - Clojure example is so much easier to modify and change. With just a few keystrokes, you can do a lot. That's basically the workflow - in Clojure, you bootstrap an app with some small, core dependencies, then start a REPL, connect to it and keep modifying your app while running it. That is what gives so much praised productivity boost. It doesn't matter how fast your compiler is (in other languages) - "save & recompile" workflow never going to be as good as working with a "true" REPL.
- goatlover 7y agoSo the Lisp/Smalltalk approach to organically growing an app.
- knubie 7y agoI've been working with clojure for over a year now and I don't really understand your demo. I think the answer to your JS question (btw the example isn't js, it's JSX, but if we convert it to the js equivalent first) is "yes." You can evaluate the string "Hello, world!"; you can evaluate `document.getElementById('root')` (I do it all the time in Chrome's js console). You can even evaluate `ReactDOM.render` assuming `ReactDOM` is in scope. I don't see any difference between the js and clojure example. What am I missing? In another comment you gave an example like: (foo [a b] ((c a) b)) stating that you can eval any part of it, but if you try to eval ((c a) b), won't the repl raise an error stating a and b are not defined?
- iLemming 7y agoAlright, fair criticism. You're right, I should've probably chosen a different example, but it still would be somewhat difficult to prove my point via text. The REPL experience working with a homoiconic language is definitely better, compared to other languages that have REPLs, it's better than with JS, with Python and even Haskell. You see, in Lisp you think and operate in units of s-expressions, any s-expression can be send to the REPL as-is, "code is data" <=> "data is code". In Javascript it also adds some hurdles of things being out of scope. In Clojure, due to default immutability - the problem space is usually small, it encourages you to write smaller functions and it is much simpler model - most of the time you can evaluate anything without any preceding ceremony. In some cases you do need to set the context as you pointed with `((ca) b)` example, but it's so trivial to do so with s-expressions and it's so tedious when working with Javascript (trust me, the comparison not in favor of the latter, I've built JS apps for over a decade).
- knubie 7y agoThanks for the reply. I'm not try to disparage clojure, BTW. I've chosen it to use for my start up, and am only pressing this point because I want to get the most out of it I can and I'm afraid I might be missing something with the REPL workflow. I think I agree with everything you've written here based on my experience.
- 7y ago
- Random_ernest 7y ago> If you never have experienced the joy of using "true" REPL, you will never understand the immense value of it. Non-lispy languages, sadly have no "true" REPLs. I don't quite understand this, could you explain it a little more in depth?
- iLemming 7y agoI tried to explain it in the adjacent thread https://news.ycombinator.com/item?id=22381081 https://news.ycombinator.com/item?id=22381081 But I think one has to experience it, to understand what makes languages like Lisp and Smalltalk so special, what is so unique about REPL driven workflow that even Python's so much praised Jupyter can't give you that satisfactory feeling. It's really nice to be able to run anything - from the smallest unit in your program, as well as the whole program and see the immediate feedback. For example: You can evaluate SQL DSL constructs and see what SQL query they compose into, and you can run that query and see the results (all without ever having to write a single line of actual SQL); or you can connect to the browser and change elements of the DOM (without writing a single line of html, css or js). You can take a complex piece of code that generates a .csv, and then analyze that csv on the fly, changing columns and rows on the go, without even saving and having to wait for the compiler to pass the checks. You can compose music and data visualizations, and etc.