Earlier quoted context omitted.
Clojure is quite capable in interactive programming, through its REPL, so you must be talking about the lack of a condition system in the clojure core. But Common Lisp features like the condition system are already available in Clojure by just requiring (loading) the respective library. :) As an example, see https://github.com/clojureman/special . Nice thing about this repo is that it points to other options re. cond…
What i'm talking is about the following: - Able to easily modify (and recompile) a function while your code is running - Able to redefine a class and then change existing instances so they use the new class definition - Able to sabe the complete running state of the system (the "image" of the system, including state of all variables, data, loaded libraries, compiled functions, etc) into a file so it can be restarted…
Ask HN: I want to start learning Lisp. Where do I begin?
201–210 of 211 posts
Re: Ask HN: I want to start learning Lisp. Where do I begin?
#202Earlier quoted context omitted.
I tried Clojure a bit and, compared to CL, I find it bloated :S Installing a library takes ages, a lot of memory, and I can't do it from the REPL (so I must quit my development environment, and start it again). CL feels very snappy. I can even install a new library to a running web app. I know it's dangerous, but it works and it helped me already :)
Libraries can be installed from the REPL in Clojure but it does require a dependency ahead of time: https://insideclojure.org/2018/05/04/add-lib/ Some of Clojure's other runtimes perform a bit better, Babashka, CLJS, CLR, GraalVM for different trade offs if you need something like a scripting language or native images etc I'm sure CL is still quicker but there are options
Re: Ask HN: I want to start learning Lisp. Where do I begin?
#203I would start with Scheme or Racket that is based on Scheme. I would start with any Scheme interpreter like Kawa or Guile. If I would recommend any book it would be Sketchy Scheme by Nils M Holm (that I've read recently) https://www.t3x.org/sketchy/ it start with basics but it have lot of details and advanced stuff about Scheme and how it works. It also as title suggest intro to functional programming. If you would l…
This book is also in archive.org: https://ia800700.us.archive.org/33/items/sketchy-lisp/sketch...
Re: Ask HN: I want to start learning Lisp. Where do I begin?
#204Earlier quoted context omitted.
Not sure Clojure can do all the recursion stuff (TCO), which would be good to have in a language, when working through SICP exercises. I would not recommend it for SICP. Better start with a Scheme, to have the least amount of friction.
You can trivially use recur for self-recursion: call (recur x) instead of (my-fn x) inside your function. (There's also trampoline for mutual recursion cases)
Even a little thing like (recur ...) could be a tiny amount of friction. But good to read, that the usual cases are apparently handled well in the language.
Re: Ask HN: I want to start learning Lisp. Where do I begin?
#205Re: Ask HN: I want to start learning Lisp. Where do I begin?
#206Re: Ask HN: I want to start learning Lisp. Where do I begin?
#207Earlier quoted context omitted.
You can trivially use recur for self-recursion: call (recur x) instead of (my-fn x) inside your function. (There's also trampoline for mutual recursion cases)
Is trampolining automatic, or does it have its own syntax as well? Even a little thing like (recur ...) could be a tiny amount of friction. But good to read, that the usual cases are apparently handled well in the language.
The trampoline pattern is an old trick that can also be imlemented in other languages to avoid stack consumption in mutually recursive calls.
Re: Ask HN: I want to start learning Lisp. Where do I begin?
#208Earlier quoted context omitted.
What i'm talking is about the following: - Able to easily modify (and recompile) a function while your code is running - Able to redefine a class and then change existing instances so they use the new class definition - Able to sabe the complete running state of the system (the "image" of the system, including state of all variables, data, loaded libraries, compiled functions, etc) into a file so it can be restarted…
> - Able to easily modify (and recompile) a function while your code is running I do this all the time with Clojure at work. I will have my application running (web app) with two repls in emacs. One is connected to the ClojureScript repl and one to the Clojure repl. I am able to make changes to both front end code and back end code on the fly by changing a function and then evaluating the function into the repl. I ca…
But since you can't arbitrarily inspect and restart any start frame, you don't really get the interactive programming experience.
On CL, for example, when you hit a runtime bug that is uncaught, you get the debugger window which shows not just the "stack trace" but the complete stack FRAMES that you can inspect. So let's say deep down you find where the error originated and the states of the variables.
You can then jump to the definition of the offending function, edit the function, recompile it, (optionally) change any variable on that stackframe, and then continue the execution by restarting specifically at that stack frame.
In this way, the feature of "modify a function while the code is running" becomes way more meaningful. The program evolves as it runs, as if it were a lifeform.
Re: Ask HN: I want to start learning Lisp. Where do I begin?
#209Is there a good argument against Clojure in this case? My impression is that it's a good lisp and you can get actual work done in it which is an advantage over some of the other options.
The main issue with Clojure is probably its tight integration with the various host platforms. When you get a stack trace in Clojure/ClojureScript, you basically get a Java or JavaScript stack trace, so there is some expectation of familiarity with the host platform. If you already have some experience with the host, then this shouldn't be a big issue, but it's a dealbreaker for some people. Another issue has to do w…
Absolutely everything mentioned above in this quote is available in Common Lisp as well by just loading the needed libraries.
>Another issue has to do with startup time. The Clojure application bootstrap process is relatively slow, i.e. start-up might take 1 second,
>The main issue with Clojure is probably its tight integration with the various host platforms. When you get a stack trace in Clojure/ClojureScript, you basically get a Java or JavaScript stack trace, so there is some expectation of familiarity with the host platform.
Correct. And there are no such problems in Common Lisp. Except if you want to execute CL in a JVM, in which case the available implementation, ABCL, does take a slow time to start. Otherwise it's a great implementation.
Re: Ask HN: I want to start learning Lisp. Where do I begin?
#210Earlier quoted context omitted.
Is trampolining automatic, or does it have its own syntax as well? Even a little thing like (recur ...) could be a tiny amount of friction. But good to read, that the usual cases are apparently handled well in the language.
The builtin helper function is called trampoline, it's a higher order function that relies on the mutually recursive functions returning "trampolines" or closures that do the desired subsequent call. The trampoline pattern is an old trick that can also be imlemented in other languages to avoid stack consumption in mutually recursive calls.
That's unfortunate, that it is an additional function call, which needs to be explicitly written out. I'd guess such is necessary ultimately, because of limitations of the JVM and its limitations regarding recursion.