I have been in the JS, Java, Python world for a while and this looks like a language that could stretch my brain a little bit.
I have been in the JS, Java, Python world for a while and this looks like a language that could stretch my brain a little bit.
None of this is because Common Lisp is a bad language. However, it does show its age in so far as its approach to documentation and user expectations. Using Common Lisp is similar to using the Unix/Linux command line. The expectation is that the user is willing to read text files that read like man pages and work their way through deep technical documentation...or to put it another way, it is very common to use EMACS when coding Common Lisp [though commercial editors are available].
To me, Clojure reflects a lot of Common Lisp's assumptions about the user being a professional programmer...to the point EMACS is pretty much the default programming environment [though other environments are available that reflect Clojure's Java heritage].
Since I mentioned EMACS twice, EMACS Lisp is another Lisp that is well documented and easy to install (in addition to being a road to EMACS). While it may be called 'a scripting language', on contemporary hardware that doesn't mean much. Just about anything a person would write for learning will run sufficiently fast within EMACS using EMACS Lisp.
Common Lisp was designed early as a more practical language.
Take for example error handling: Common Lisp has a nice error handling system integrated into the language since the mid 80s. Scheme never had something comparable specified in its standards. Sure you can add error handling on top, but it won't be integrated well into the wider language.
There are many aspects where Scheme was underspecified for decades and efforts to redesign the core language were slow, controversial and not really providing nice results. Many Scheme designers wanted the language to be kept as small as possible (R5RS level). The R6RS design was controversial and R7RS 'large' is a very slow effort...
In many ways, Common Lisp is as a practical Lisp language better designed than the average Scheme and Racket is just another Scheme going in its own direction. Actually if you read the Racket docs, it is a very complex system.
One also could use the excellent Chez Scheme (which now is open source) or Chicken Scheme.
The ideas of Racket onboarding beginners is also confusing: multiple languages with some integration mechanism with various degrees of different features and semantics. Much of that is not really needed, but a nice experiment in language modularity. Added to that an IDE which favors batch programming for beginners... In a teaching setting it helps reducing side-effects ... each 'Run' is a new program start.
To be clear, I think Common Lisp is a great language and in no small part this is due to the stability that its design by consensus and reference standard over approximately a decade by a group of seriously competent programmers and computer scientists. The price of Common Lisp is the RTFM tradition of onboarding users, TANSTAAFL.
I agree that Racket ecosystem is complex. There is a valley that contains the basic abstractions of Erlang [1] and Algol Mesa is accessible right out of the box and Scribble for writing documentation. Of course, the fact that all that complexity is documented in the standard distribution (and generally very well documented) is [at least for me] a feature not a bug.
Finally, my current take is that 'easy' onboarding of users is a bait and switch for any programming language [2]. Eventually there is an inflection point where the answer is RTFM. It just comes earlier or later in different language communities. With Common Lisp it comes much earlier than is typically expected by programmers today. StackOverflow is more likely to be a first attempt at problem solving than Steele's Common Lisp the Language.
[1]: http://docs.racket-lang.org/guide/parallelism.html#%28part._...
Just pick any language implementation exclusively -> no more incompatibilities.
> With Common Lisp it comes much earlier than is typically expected by programmers today. StackOverflow is more likely to be a first attempt at problem solving than Steele's Common Lisp the Language.
Well Steele's Common Lisp the Language is outdated anyway. Today one uses the ANSI CL standard, which is less confusing than CLtL2, which was documenting a language in flux.
Actually I don't think Common Lisp users will need to refer to documentation earlier than Racket or any other complex programming system (Java, Scala, Haskell, ...).
I have seen now a lot of people coding Java and I can tell you that documentation-less attempts at development don't work well. Many of the programs and coding styles I have seen are just horrible. It's actually kind of sad. I have seen senior Java developers not knowing how the language works at basic levels, even though they claim to work with complex frameworks.
Recently I have interviewed a professional Java programmer with a few years experience and he had lots of free time at work. He could have read some books to learn something instead of looking out of the window, but he said that he wasn't interested in computer science anyway... though it might have been a joke, I fear it was serious... Anyway, he was a nice person and had some potential.
This is one of the reasons I started to only use vendor SDK languages for production code, in spite of the languages not being as good as some alternatives.
Chicken Scheme is my favorite, but Racket or Guile would work too. Guile is good because Emacs is slowly transitioning to using it, and Racket for its great ecosystem.
Chicken Scheme itself compiles down to C, so it's quite fast, portable, and light-weight. It also has a great ecosystem, library of eggs, and community.
Others have mentioned Elisp, which emacs uses, and that's good too if you are interested in emacs. It would just be a shame to start with it and get the impression that that's the best that a Lisp-like language can offer when it's really rather primitive compared to a modern Scheme, Clojure, or CL. I myself learned Elisp last, after already learning CL and Scheme, and found doing so to be very easy after having learned the others. So I'd really recommend starting with one of the others and learning Elisp last, if you're in to emacs.
For exploring Lisps in general, such 'strange loops' around building tools do not seem quite as obvious obvious or natural. Particularly at small scale programs.
Emacs on Guile is nearly a one-man project that has been progressing in fits and starts, and it's not guaranteed that that branch will be adopted as the Emacs mainline. Basically, the Emacs devs are telling the Guile folks that the onus is on them to make something worth integrating into the Emacs core, and so far it's nowhere near that.
But it's important to realize that Emacs on Guile is only about using Guile as the runtime for Emacs Lisp, as multiple languages can compile to Guile bytecode, not just Scheme. Even if Emacs on Guile happened, the user would not program in Scheme, but still in Emacs Lisp.
Well, you could program in eLisp, and most people probably would, but you could also program in Scheme. Most emacs programs would remain in eLisp for a long time, though, as it'll take a while to convert them all over to Guile.
So, yes, this is a long-term project, and most people would continue to program in eLisp for the foreseeable future, but some would program in Scheme and try to convert existing eLisp programs to Scheme.
That's my understanding of the situation, anyway.
The #1 issue for folks in my experience had been getting an environment set up. Emacs, SLIME, encodings, paredit, ... . It's a big barrier to entry.
That said, for people who want to start with CL now, I'd recommend grabbing https://shinmera.github.io/portacle/. It's a portable Lisp IDE based off a pre-configured Emacs + SLIME + SBCL + Quicklisp + Git combo. I can confirm that it Just Works, out of the box.
"For Leiningen users... Add it to your ~/.lein/profiles.clj:"
I truly want something that's not for "Leningen users" (or "Boot users") but for people who've never heard of any of those things and just need to start learning how to write code (in Clojure).
Not surprising, given that Common Lisp itself is pretty much immortal compared to the typical lifetime of things in our industry :).
That said, I know what you mean. I started with Lispbox years ago, and it was already feeling its age back then. I agree with your observation. Sadly, the commercial CL scene seems pretty weak - the two big players (Franz and LispWorks) seem to mostly keep to themselves and focus on the commercial tools they offer.
What I like about Common Lisp is that it is not in flux and so when I Google up a question, the information I get may be ten years old but it is highly likely to be correct. The price is that the format of the information may be more like a technical textbook than a blog or a StackOverflow answer.
Quick lisp solved it mostly, but Roswell is the finishing touch in my opinion.
shell$ sbcl
[... some editing ...]
sbcl> (load "file.lisp")
As for which Lisp. I advise Common Lisp since it's the most practical of the lot. Doesn't force you into a particular paradigm.If you are only interested in getting into the syntax. It almost literally doesn't matter. If you are interested in learning a lot of tricks that you've probably not had a lot of exposure to, CL is almost certainly the more bountiful place to start.
It's self-hosted in JavaScript and Lua. It matches the JS runtime as closely as possible, so if you're comfortable with JS, Lumen is basically a wrapper around it.
Think of it like CoffeeScript on steroids.
There isn't a lot of documentation, but if you have any questions I'm happy to answer them.
Lumen looks interesting and I dug up some HN comments from over the years.
Any example apps or sample code anywhere?
What about host language access? I'd rather not give up using existing JS and Lua libraries.
I can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser?
Have you used this inside Nginx's Lua module and/or OpenResty?
Why not Python as one target host language? Lists and hashmaps (dictionaries) are pretty prevalent there and I believe continuously developed Lisp dialect is still missing.
Thank you for this. I learned new things already.
Easy:
$ npm i leftpad
$ LUMEN_HOST=node lumen
> (require 'leftpad)
function
> ((require 'leftpad) "foo" 10)
"0000000foo"
> I can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser?Yes, the entire codebase is only 3k lines. You can use browserify, or simply concatenate all the JS files together. Lumen is unopinionated.
I've done this before, and I'm more than happy to set you up with a copy-pastable solution if you want.
> Have you used this inside Nginx's Lua module and/or OpenResty?
No, but there's no reason it wouldn't work. Here's an example of it working in a WASM Lua implementation: https://news.ycombinator.com/item?id=13900453
> Why not Python as one target host language? Lists and hashmaps (dictionaries) are pretty prevalent there and I believe continuously developed Lisp dialect is still missing.
I've spent time on this! It's a difficult problem. In Lua and JS, you can attach keys and values to arrays. In other words, an array can also be a hashmap. Not so in Python -- or rather, not with the standard Python dict() type. And then you run into problems of interoperability and performance: if it's a non-standard type, other libraries run into problems consuming it. This is less true of Python than other languages, though, so I've been trying to find a happy medium.
There are ways of using solely arrays, but it involves having some sort of Keyword type. A normal lisp has those, and typically they use '(a b :x 42) to create an "array" where the first two elements are "a" and "b" and the key "x" has value 42. You can do something similar for Python, and it's an active area of research for me.
> Any example apps or sample code anywhere?
This is Lumen's strength and weakness. Very few people know about Lumen because of a lack of examples and documentation. However, it's incredibly cool and quite mysterious, and I like that it has a very small following. It makes changing the language much easier.
Here's an extensive example: https://github.com/sctb/motor
Note that it won't run on the latest Lumen, because dot syntax was recently removed. You'll need to revert to commit `c146de`. But you see how easy it is to morph the language into whatever shape you want, and how powerful it can be.
>Easy:
$ npm i leftpad
$ LUMEN_HOST=node lumen
> (require 'leftpad)
function
> ((require 'leftpad) "foo" 10)
"0000000foo"
Huh. It just worked. With rlwrap this feels (at least at the very first try) regular REPL!>> I can see there's REPL, but is it possible to have dynamic evaluation while running inside web browser?
> Yes, the entire codebase is only 3k lines. You can use browserify, or simply concatenate all the JS files together. Lumen is unopinionated.
Amazing. That sounds very compact to me. I'd imagine today's JS build systems can do optimized builds without too much trouble. Also, by that count it should be an afternoon's read to get it.
> I've done this before, and I'm more than happy to set you up with a copy-pastable solution if you want.
My answer in your other comment.
>> Have you used this inside Nginx's Lua module and/or OpenResty?
> No, but there's no reason it wouldn't work. Here's an example of it working in a WASM Lua implementation: https://news.ycombinator.com/item?id=13900453
Ok, must do some testing. I have nothing against Lua, but having a Lisp within Nginx/OpenResty just seems more fun.
>> Why not Python as one target host language? Lists and hashmaps (dictionaries) are pretty prevalent there and I believe continuously developed Lisp dialect is still missing.
> I've spent time on this! It's a difficult problem. In Lua and JS, you can attach keys and values to arrays. In other words, an array can also be a hashmap. Not so in Python -- or rather, not with the standard Python dict() type. And then you run into problems of interoperability and performance: if it's a non-standard type, other libraries run into problems consuming it. This is less true of Python than other languages, though, so I've been trying to find a happy medium.
> There are ways of using solely arrays, but it involves having some sort of Keyword type. A normal lisp has those, and typically they use '(a b :x 42) to create an "array" where the first two elements are "a" and "b" and the key "x" has value 42. You can do something similar for Python, and it's an active area of research for me.
Yeah, I realize there's all sorts of pitfalls. I thought about 3.6 having by default ordered dicts could make things easier. But probably not. Perhaps if I'd do array indexed access in Python with a helper method "transpiled" where necessary. In my own code I could keep from using other, harder to support Pythonisms.
>> Any example apps or sample code anywhere?
> This is Lumen's strength and weakness. Very few people know about Lumen because of a lack of examples and documentation. However, it's incredibly cool and quite mysterious, and I like that it has a very small following. It makes changing the language much easier.
> Here's an extensive example: https://github.com/sctb/motor
> Note that it won't run on the latest Lumen, because dot syntax was recently removed. You'll need to revert to commit `c146de`. But you see how easy it is to morph the language into whatever shape you want, and how powerful it can be.
I'll check it out, thank you. And thank you for this!
Then I invoke it like `lwrap lumen`. I use multi-line mode pretty often, and I have this in my ~/.inputrc file:
"\e\C-m": rlwrap-call-editor # ALT-RET
So at Lumen's prompt, I usually type () followed by Alt-Return, which drops me into MacVim and I edit from there.If you're a vimmer or an emacs user, I can set you up with some basic tooling to make things easier.
Here's a version of Lumen you can copy-paste directly into your browser console:
https://gist.github.com/anonymous/c8e26607668dd6240f606fc2d0...
That's not too convenient, but it's easy to create a wrapper around these building blocks.
If you have any other questions at all, please don't hesitate to ask. I love talking about this stuff.
> Here's a version of Lumen you can copy-paste directly into your browser console:
> https://gist.github.com/anonymous/c8e26607668dd6240f606fc2d0....
> That's not too convenient, but it's easy to create a wrapper around these building blocks.
I got Lumen evaluation going on page load with this and it was surprisingly easy!
>If you have any other questions at all, please don't hesitate to ask. I love talking about this stuff.
It very late here, have to try and get some shut eye. I'll be playing with Lumen more now that I got over the first step, thanks to you. I'll be checking this thread and Lumen's repo soonish, I hope.