292 points · by t-sin · 8y ago · 300 comments
I am heavily invested in Common Lisp. We are developing a programming environment for designing new materials and molecules called Cando (https://github.com/drmeister/cando) using Common Lisp as a scripting language. Cando is running on Clasp (https://github.com/clasp-developers/clasp), a new Common Lisp implementation that interoperates with C++ and is based on LLVM.
What attracted me to the language, after 35 years programming in almost everything else, was how organically it lets one write software and how I don't have to worry about it fading like the next programming fad.
Have you had an opportunity to look at Julia? It seems that there is some overlap in what can be achieved - with some obvious differences: as I understand it you had a lot of c++ - that could probably (today) be linked from julia, but not "integrated", starting from a green field with Julia, ideally one could do most things in Julia - maybe with some help from rust. And Julia is not a common lisp, obviously.
But in merging a high level language and the love, it seems Julia has been successful in getting a lot of real-world, "all Julia" libraries, with "sufficient" performance.
If you were starting over today - would you still prefer to build a common lisp with close integration to c++?
I did choose Common Lisp over Julia - I started learning Common Lisp in 2013 and Julia started becoming something around 2012.
I did so because of the permanence and the demonstrated expressiveness and power of Common Lisp. Common Lisp has been around for almost five times longer than Julia, and Common Lisp has demonstrated again and again that it is capable of solving hard, poorly understood, real world problems in a lot of domains.
Fun fact: Julia bootstraps off of an implementation of Lisp. Furthermore, most compiled languages are translated into an abstract syntax tree (AST) as part of compilation. Lisp S-expressions are a text based AST. So I can make the argument that Lisp is as close the "One True Programming Language" that we have. :-)
I'm doing chemistry - that's fundamental and timeless - I find it maps beautifully to a fundamental and timeless language like Lisp.
[1]: http://terralang.org/api.html#using-c-inside-terra . The same idea also occurs in e.g. Python DragonFFI.
We exposed the AST and ASTMatcher libraries of Clang inside of Clasp and we use it to analyze all of the Clasp C++ code to build an interface to the Memory Pool System memory manager.
I want to have something that can include C and C++ header files and automatically expose them to the Common Lisp - that would be neat! Maybe we can steal some ideas like the includec function of Terra.
And you're my hero. For having the big courage to write a completely new CL implementation, and attempting what wasn't attempted before: LLVM output, great C++ interoperability. Even more, leveraging the latest state-of-the-art compiler modules (Cleavir, etc.)
Keep on with the good work, dr. Schafmeister!!
I'm not sure I understand this bit. What other programming language has "faded" and how has it "faded"? At least since the more mature age of software, which I'd say started around '95 or so (so 20+ years).
Common Lisp doesn't have this problem - and it has many features that other languages have added over time, often in less comprehensive ways. For example C++11 lambdas are not as expressive and powerful as Common Lisp first class functions, and I joke that C++ template programming is to Common Lisp macros what IRS tax forms are to poetry. Note: Clasp includes a lot of C++ template programming and C++ lambda code that I enjoyed writing and I am so grateful that C++11 added variadic templates. New language features can be added to Common Lisp by the programmer with macros, and for the really adventurous, they can be made efficient by augmenting the Common Lisp compiler. Common Lisp compilers are almost always written in Common Lisp and available and accessible. This is why Clasp uses a new and understandable Common Lisp compiler "Cleavir" (developed by Robert Strandh) and LLVM, which is a great C++ library for generating native code on a variety of processors. Cleavir will be an excellent platform for efficiently implementing new dynamic programming language features.
While that made for very nice war stories, it also meant that you’d have the “ship” sinking under you completely. Now a tech still stays around to some degree.
A C developer from 1990 could still be a C dev in 2018. A Java dev from 1998 could still be a C dev in 2018. And a programmer in your average mainstream language in 2018 could reasonably expect to be working in the same language in 2018. Especially if that language has enterprise traction (Cobol, Java, C#, Javascript, SQL, etc.).
Also, languages are a lot more similar to each other than they used to be, in terms of expressiveness and power. Lisp was a “lightsaber” to the “stones” of the 80’s, now it’s at most a slightly more powerful “machine-gun”, at best.
And regarding language evolution itself, everything evolves. Or did Common Lisp programmers generally write unit tests, have integration test harnesses, use package repos, etc. back in 1995? I somehow doubt that :)
I will definitely be stealing this quote in the future! Well put.
C++ template programming necessarily followed a very different style than it does since variadic template were introduced with C++11. There were books written before C++11 wherein much of them was obsoleted by variadic templates. You do not want to let students get hold of those books and think the old way was the way things have to be done. Compare how boost::python was (is? I haven't dug into it recently) written compared to pybind11 - night and day differences in readability thanks to variadic templates. That's not a dig at boost::python - it was written with the C++ they had back then and it had to use Lisp-like list comprehension with tedious replicated boilerplate code to unpack argument lists.
Then there are raw pointers in C++ - we aren't supposed to use raw pointers anymore. We are supposed to use references and std::unique_ptr<x> and std::shared_ptr<y> and this thing called "move semantics". That stuff sucks for directed graphs and so I switched to compacting, tracing garbage collection for Cando.
C++ is being developed in a way that it retains backward compatibility with existing code - thank goodness for that! But there are styles of programming even for something as staid and venerable as C++ that, while supported, should pass silently into the long, dark night.
Then you have a language like Python that made sensible but breaking changes between versions 2.x and 3.x. Wow - look at the problems that is still causing. I love Python but I won't do anything with it that I can't rip out root and branch with more than a few weeks work. I say that even though Clasp's build system is completely implemented using the very excellent Python based build system 'waf'.
Then you have Javascript - it seems to change every time I blink. That doesn't mean I will stop using it for our web based Jupyter notebook user interface. Javascript is the only game in that town. I just close my eyes and hold on tight and try not to scream.
Common Lisp isn't like any of those, it grew out of a lot of very careful thinking and was specified around 1984 darn near perfect. There are some warts (logical pathnames - I'm looking at you) but even its warts are better thought out than some other languages features. Better implementations and more and better libraries come along - but the language has the same expressiveness, power and permanence it has always had.
Cobol? Seriously, there are probably more Cobol programmers than there are Python programmers.
And C? Most of the world runs on C, and its irreplaceable language in a non desktop computer.
And you will be surprised how much Perl code is written everyday.
The root comment is talking about the fad of the year, the kind of a language web devs use as flavor of the year. The current ones are Javascript frameworks. In this case the 'fade' is just the web framework, that probably has less mind share and open source dev contributions.
But ML, Eiffel and Modula were never mainstream.
And Perl, Fortran, Cobol probably still have more programmers out there than Common Lisp has :)
On a more personal front, I find Lisp to be simple, elegant, and expressive. I use Common Lisp (SBCL) for personal use. Working with Lisp induces a sense of wonder: how simple concepts can be composed elegantly to build complex functions and complex software. It's the same kind of sense of wonder one feels when one learns how the simple concepts of Euclid's postulates can be used to prove complex concepts in Geometry or how the Newton's laws of motion can be used to derive intricate and complex concepts in classical physics.
I sometimes wonder why Lisp has not been more popular in the technology industry. Is it the lack of sufficient marketing? Is it the lack of an extensive library ecosystem? I hope Quicklisp will address the concern about library ecosystem for Common Lisp.
I encourage everyone to learn Lisp and, if feasible, write a rudimentary interpreter or compiler for Lisp s-expressions. It's one of those things that can broaden's one horizon in the field of computing.
3: Most useful libraries are portable between different CL implementations. The choice is really "CL or Clojure or which Scheme implementation?" Not to discredit Picolisp or Shen, but those languages feel very much (esp. Shen) like a research language. Picolisp has more of a convincing productivity story, but doesn't seem like it has the momentum of existing competitors and I fail to see an advantage in using it. Depending on your goals, the choice between Lisps can be pretty simple.
5: Portacle is helping in this area by making it much easier for a beginner to learn CL without fussing with setting up SLIME and Emacs. Clojure also has an IntelliJ plugin, cursive. For Scheme, Racket seems like a painless way to start learning.
6. You can easily go multi-core in CL. It isn't as easy as Clojure, but it's definitely easier than C++ or Java (the language).
7: Clojure has access to all of Java's libraries. CL does struggle compared to Python in this area.
8: Lisp related books are among the best in CS. SICP, LoL, etc. are timeless.
The Lisp family of languages definitely have room to improve, but the ecosystem is healthier today than 20 years ago, for sure.
Lisp books also tend to have the characteristic where you have to find the "right" compiler for the examples to work. I've yet to pick up a book where all the examples "just work".
You mean because of the availability of libraries, so that the code would be something like
import some_database_library
print("Look, I have a database:", some_database_library.connect())
?Otherwise, how do you build a database (or anything involving MP3 files) in a few lines of Python, and how is it so much worse in Lisp?
You are mixing things into that list. Common Lisp, Racket, Clojure, and Shen are different languages, serving different purposes, etc.
"Franz", "Allegro", "ABCL", "SBCL" are implementations of Common Lisp, exactly the same language.
ALGOL-family languages are also "fractured" into Algol-68, Pascal, Go, Ada and others, that's not a problem, since they are really different languages that give different benefits/etc.
>"4.) poor windows support for SBCL"
SBCL works just fine on windows. But if you don't like, just use CCL (Clozure CL). I'm currently on a Lisp project which runs equally great in SBCL and CCL. CCL is professional quality software.
>6.) multi-core seems to only be in Clojure
False. There are many libraries to do all sort of concurrency and multiprocessing on Common Lisp.
>8.) learning resources are very hit or miss
At least for Common Lisp, there are books that are arguably some of the best books on programming ever written, like "Practical Common Lisp", or PAIP. For Scheme, "Structure and Interpretation of Computer Programs" is already a high-rated classic.
>notice how many people equate lisp with personal projects?
Except when it's used by Rigetti for quantum computing, or Grammarly for the core server of their core business.
ABCL, FRANZ, ALLEGRO, SBCL, CLISP, GNU CL, Clozure might all be common lisp, but they are different implementations with different tools that will confuse a new person and several cost money.
Practical Common Lisp isn't very good in my opinion, that was the example i actually used. SICP is great for a mind-opening experience, but not super useful on how to write modern software and is why the creators dropped it at MIT.
For multi-core I'd rather it be core than a library, but perhaps that is petty of me.
I think Lisp is great, but why it isn't popular shouldn't be a mystery to anyone.
And anyway, if you want concurrency and/or paralellism, just go for OTP (Erlang, Elixir, LFE).
Well, I think you've got your answer right there. Out of 100 people learning about newton's law of motions at university, how many are witnessing their intrinsinc beauty ? Maybe one or two ? And I feel like I'm being fairly generous; most just find it boring and just want to pass the test. They never feel that sense of wonder.
I certainly never felt it for Newtonian physics either, but I'll admit that the relationship between linear algebra and matrices made my heart pinch a bit at the time.
Likewise, most people (doing a programming job) are utterly bored by "how simple concepts can be composed elegantly" ; they just want to make the damn thing work, close their tickets and go back home. They don't read HN or LambdaTheUltimate any more than your average construction worker does read construction working forums, or your average accountant does read accounting forums.
For complex problems, without clear solution, Lisp is still used (from what I've read) because the people on these tasks are actually looking to find the right concepts and needs a metamaterial rather than a fixed set of bricks.
I think one of the problems is one of marketing.
The hackers of the 60s wouldn't have cared but there must be a number of people and businesses since who have been put off, consciously or unconsciously, by the language having the same name as a speech impediment.
I'm being entirely serious; I think the language would have been more popular with a cooler name.
Another problem is a perception of Lisp as being an old language. When I tell work colleagues about how great Lisp is, they're put off by it having been around a long time. I tell them that's ridiculous, the /computer/ has been around a long time, should we abandon that? But it is an uphill struggle.
How do you explain the lack of popularity of Lisp dialects that do not use "Lisp" in their name, for example, Arc, Racket and Clojure. I know that HN was written in Arc, Arc was written in Racket and Clojure is used in a handful of companies but a far greater number of companies and projects use Python.
The compiler tells you the usual (?) stuff like missing args, wrong named arguments, missing functions, undefined variables, syntax errors, etc.
But Common Lisp has also a (relatively primitive, compared to something like Haskell) type system and the SBCL compiler can make use of type declarations (for compile time type checking and for runtime type errors) and does also do some form of type inference.
With SBCL you get all the interactive dynamic features and a compiler which you can use to check your code and make it faster. The compiler can for example tell you which operations it could not optimize and why. Then you can decide if it is worth to put some effort into improving the code - for example by adding better type declarations. Common Lisp also lets you inline code or have some data be stack allocated...
Common Lisp also has a sophisticated error system, which allows you to get lots of excellent error reporting and handling.
What SBCL is doing to Common Lisp is similar to what C compiler vendors did to C. In order to win at benchmarks, C compiler vendors started to use UB as a license to miscompile optimized code, which got them better benchmarks.
Common Lisp has very little UB, so the C strategy is harder to execute.
SBCL basically first needs to sucker their users into overusing one corner of the language that does have UB, type declarations.
They get their benchmarks, at the cost of saturating the ecosystem with code that overuses UB, basically poisoning the ecosystem.
Python today has the best numeric computing libraries (numpy and sisters) which make it the most widely adopted language for scientific computing, ML, etc.
Ruby had Rails - the web framework that trail-blazed convention over configuration and rapid productivity and was considered leading just a few years ago. Ruby's popularity has waned since then as performance and scalability has become far more critical than plain productivity alone.
Perl had the best regex features and reporting facilities fifteen+ years ago. It has lost its crown and is rapidly declining since Perl 6 took forever and is basically a completely different language.
One major reason was hardware.
Lisp might have started in IBM mainframes, but the development environment from Xerox and the Lisp Machines that followed up where quite expensive for single developers, back when the industry was heavily focused on bringing down the costs of time-sharing services, which where owned mostly by mainframes, VAX and UNIX systems.
So when the workstation market started, Lisp machines had to fight against UNIX workstations, while being quite expensive, they were still cheaper than Lisp ones.
So the price, coupled with misunderstanding from Lisp from more regular developers busy with Algol, Fortran, PL/I and such, and lots of management mistakes doomed it.
Also quite important, 8 and 16 bit home computers were not yet able to deal with the hardware requirements of Lisp enviroments.
Note that this also affected C++. Lucid pivoted from Lisp Machines to C++, offering a Lisp like development environment that only now we are getting back thanks to LLVM and efforts from the major IDE vendors.
Nowadays we have pocket computers more powerful than SGIs.
There was a Lisp called XLisp for PCs early on, but it was buggy, IIRC. Had tried it out a bit. Just googled, here is a link about it from later on: http://www.xlisp.org/
Lucid pivoted from Lisp on UNIX to C++ on UNIX, they didn't have anything to do with Lisp Machines.
Yep, I always get that part of Lucid's history wrong.
Larry Wall said that a language should make the easy things easy, and the hard things possible. I think the problem is that Lisp doesn't make the easy things easy.
Before you tar and feather me, hear me out. There are two different ways in which Lisp doesn't make the easy things easy.
First, syntax. "But it's easy! In fact, it's the easiest!" you reply. But for the vast majority of programmers, Lisp syntax is not easy. You could argue that they just need to be trained. But the syntax is different enough that they are reluctant to try.
Second, installation and package management. This is part of what is now expected to be easy. If Lisp doesn't have an install and package management that is as easy as, say, Perl, that's a problem that will turn people off to Lisp.
Could be more of NIH syndrome, since most of them would have learned another language first, which had an Algol-family or other-than-Lisp syntax (IMO). And regarding "You could argue that they just need to be trained", practice is also needed in order to feel comfortable with it.
I suggest that learning Lisp's syntax is easier than learning C-like syntax. There is learning involved, however, and that undoubtedly keeps people from lisp. But s-expressions are the secret sauce; there is no modern lisp without them.
>installation and package management
This is basically a solved problem at this point. Clojure has both Lein and Boot to handle dependencies and building. CL has quicklisp (as easy as `(ql:quickload :my-system)` for installation) and asdf for "building" and system definition.
When it comes down to solving problems, I feel that interactive development (with SLIME), Quicklisp, and ASDF make me extremely productive, and the easy things are easy.
I created 3 layered notations to keep Lisp's capabilities (including macros and homoiconicity) while making it easier for normal programmers to read. Instead of "getting rid" of S-expressions, I think adding just a few standard abbreviations to the Lisp reader makes Lisp more acceptable to more developers. See: https://sourceforge.net/projects/readable/
[me and a few of my friends] ...
In the late 70s, cheap computers (IMSAI, Altair) were almost unable to run Lisp for useful purposes. Too little memory.
Minicomputers (DEC PDP /etc) were able to run full Lisp implementations but it worked slower than using other languages.
Lisp Machines (MIT CONS, etc) were able to run Lisp fast but those were dedicated, specialized hardware. And expensive.
Enter the late 80s; Lisp ran great on personal computers but implementations AFAIK were mostly commercial, so reserved to big budgets. I'd say Common Lisp did have success on the industry, used for many things (3D, CAD/CAM, simulation, etc).
Meanwhile the rest of the world was on Pascal, C, and C++.
Nowadays things are different, there are many Common Lisp implementations that are free and are good (SBCL and CCL, for example, are lightning fast).
But additionally, it is difficult to understand what advantages would Lisp bring. For this, the developer would have to grok (completely understand) the enormous value of metaprogramming, and to understand as well how flexible is CLOS.
minus Maclisp
> Enter the late 80s; Lisp ran great on personal computers but implementations AFAIK were mostly commercial, so reserved to big budgets.
CLISP, CMUCL, AKCL, XLisp, ... all were no cost.
> SBCL and CCL
SBCL is a fork of CMUCL which was started in 1981 as Spice Lisp. That was always no cost and several other projects took code and documentation from CMUCL.
CCL is a free version of MCL - which was an affordable commercial Lisp for Macs in the end 80s.
One historical reason:
https://en.wikipedia.org/wiki/AI_winter#The_collapse_of_the_...
Data-point of one here, but I was instantly turned off by the conflation of the empty-list, nil, and boolean-false. I could tell instantly that I'd have a hard time interfacing with data from other real-world systems, so I decided to skip CL and stick to Clojure and various Schemes for my lispy kicks.
If it doesn't have nil that is also false and the empty list, it is not a Lisp.
The conflation is a stroke of genius. I was immediately attracted to Lisp because of its clever handling of lists and booleans. Also how nil is a symbol, but () means the same thing as an alternative spelling.
People who wake these things out are imbeciles who are mutilating their language to the point it shouldn't be called Lisp.
How nil works in Lisp has a tremendous virtue: it blows away a lot of useless verbiage from code that manipulates code.
Ancient Lisp in the 1960's didn't allow car and cdr on the empty list nil. The Interlisp people realized that it was an inconvenience to always have to test consp before using car or cdr so they turned the functions polymorphic, allowing (car nil) -> nil, and (cdr nil) -> nil. According to the HOPL History of Lisp paper, the MacLisp and Interlisp people held a conference. They didn't agree on some things, but MacLisp adopted (car nil) -> nil and (cdr nil) -> nil from Interlisp. It's a compelling idea; taking it out of a supposed Lisp dialect is a counterproductive regression.
Scheme is generally considered a Lisp.
Oddly enough, that’s almost always something I consider a feature, even when I'm interfacing with the outside world. If I’m expecting a list, then NIL is just an empty list; if I'm expecting a value, then distinguishing NIL & false hasn’t caused me trouble. Worst-case, it’s been something I take care of at the mapping level, and don’t worry about anywhere else.
In return, actually using Lisp is really pleasant. Using Scheme tends to be a lot more verbose, because it makes a distinction where it doesn’t really have to.
(in-package :my-package)
(shadow 'if)
(defmacro if (condition then else) `(cl:if (true? ,condition) ,then ,else))
(defgeneric true? (thing) t)
Defining appropriate defmethods to make things work the way you want is left as an exercise.
In [1]: [] is None
Out[1]: False
In [2]: [] is False
Out[2]: False
In [3]: [] == False
Out[3]: False
In [4]: [] == None
Out[4]: False
In [5]: False is None
Out[5]: False
In [6]: False == None
Out[6]: False
This kind of relatively fine-grained distinction between different types of data is essential for operation in a world where other systems presume that you can handle these distinctions.The word "disappear" is a hyperlink to a pdf, which refers to domain-specific design-patterns. I don't quite seem to grasp what is being implied on the home-page.
Is it something like Lisp is very customizable and allows you to easily overload operators? (I am primarily a Java programmer and have never used Lisp).
EDIT: I mean, e.g. this page asks "Are Design Patterns Missing Language Features" http://wiki.c2.com/?AreDesignPatternsMissingLanguageFeatures
Is this what's being referred to, and if so, what makes Lisp especially good for adding language features?
The best simple explanatin I found for macros is this one [0].
In a rough sumary: you could add to lisp any "missing" functionality -present in another language- with just macros (without altering the compiler/interpreter), and this functionality would work as if it was in the compiler/interpreter from the beginning.
[0] http://www.gigamonkeys.com/book/macros-defining-your-own.htm...
However, there are also symbol macros and reader macros as well, each of which are used to make Common Lisp massively extensible and an amazingly expressive language.
If you are interested in Lisp on the JVM check out Clojure.
In the last 35 years I have probably only averaged using Commin Lisp for about 10% of my development but still love the language.
One problem the Lisp world has is too many fine implementations of dialects of different Lisp languages. I find it impossible to not experiment with most of them.
I experiment more with different versions of Scheme: Gambit, Chez, and Guile. I really like the Racket ecosystem - a lot of good work is done around Racket. I don;t much use Clozure (except for my hobby site cookingspace.com) unless I am using it because that is what a customer uses.
Church, for Probabilistic programming is interesting but it was apparently been supplanted by WebPPL(which is not a Lisp).
Here are my recommendations:
- Choose Common Lisp because it has been the most popular dialect of Lisp in the overall history of Lisp. It is more convenient than Scheme if one decides to develop serious software in Lisp. Clojure appears to be more popular in the technology industry than Common Lisp among organizations (my workplace included) that use Lisp. I still recommend Common Lisp because I believe that it is more likely that one would work on an independent open source or hobby Lisp project than one would encounter one of the rare organizations who use Clojure at work.
- Choose SBCL (Steel Bank Common Lisp) as the implementation.[1][2] It is the most popular Common Lisp implementation and is recommended in many online discussions. CCL (Clozure CL, not to be confused with Clojure which is a separate dialect) is also another very good implementation. I still recommend SBCL because as a result of its greater popularity, it is readily available via package managers such as brew and apt-get as well IDE packages such as Portacle, Lisp in a Box, etc. CCL is currently missing from both brew and apt-get.
- Work through this book: Practical Common Lisp: http://www.gigamonkeys.com/book/ (available in print too if you search online). Skip the sections about Emacs and SLIME if you don't use Emacs.
- There is no need to use Emacs if you are not an Emacs user. Any good editor would do.
- A Vim user may consider installing Slimv[3][4]. Superior Lisp Interaction Mode for Vim ("SLIME for Vim") or Slimv is similar to Emacs/SLIME, displays the REPL in a Vim buffer, and comes with Paredit mode that makes typing and executing Lisp code quite convenient.
- Emacs with SLIME or Vim with Slimv are quite useful but not necessary. To get started quickly without being bogged down by the details of an editor, just execute the Lisp source code file on shell.[5]
- Optionally, keep another implementation of Common Lisp. Common Lisp is a standard that is implemented by various implementations. Each implementation may have its own extensions or implementation-specific behaviour regarding error handling, command line options, FASL format, unspecified behaviour, etc. Experimenting with concepts with another implementation of Lisp occasionally may offer some perspective about how some things could be different in different implementations. I keep CLISP around for this purpose.[6][7][8]
[1]: Install SBCL on macOS: brew install sbcl
[2]: Install SBCL on Debian-based distro: apt-get install sbcl
[3]: Slimv in a ZIP file: https://www.vim.org/scripts/script.php?script_id=2531
[4]: Slimv as a Git repo: https://github.com/kovisoft/slimv/
[5]: Load (execute) code in a file and exit: sbcl --script foo.lisp
[6]: Install CLISP on macOS: brew install clisp
[7]: Install CLISP on Debian-based distro: apt-get install clisp
[8]: Unfortunately CLISP is missing from Debian's stretch (stable) repository but it is available in its buster (testing) and sid (unstable) repositories. Hopefully this will be addressed when buster becomes stable. CLISP is available on Ubuntu.
Also most tutorials/books I found don't guide you on how to build an application/structure your code – which is rather confusing for a beginner. You have to spend a lot of time and try and error to get things working using Quicklisp. I got often the impression, that since Lisp is so old, everyone using it knows how to do things and forgot to document for newcomers their knowledge.
Common Lisp Recipes by Edi Weitz.
That's from 2016 and it covers a LOT of practical Lisp lore. Basically Edi wrote down much of his knowledge how to write Lisp code. Not only from hobby projects - Edi also has extensive knowledge from commercial projects.
The commercial, and expensive, Lisps also have extensive facilities and documentation how to deliver applications. LispWorks for example supports delivery as standalone programs, applications with GUI, shared libraries and delivery for iOS and Android apps. Edi Weitz for example wrote a bunch of applications for Windows with LispWorks.
http://www.lispworks.com/documentation/lw71/DV/html/delivery...
* in ABCL you would generate a jar file, just like with java or clojure
* in SBCL you could dump a core file, there are some tools that can package that up in a command line binary
* if you use a bytecode compiler(like clisp), you'd use that the same way like python or ruby, you'd put your script in a text file, with a #! line at the top and run it like any other shell script.
* if you use a Lisp->C compiler, you'd generate C code and then compile that with GCC or Visual Studio or whatever
* if you use image based programming, you'd just load your code in the lisp image and just use lisp itself as your command line, your "binary" would then be just a normal lisp function.
* If you're deploying a service, you might want to package it in a docker image or even a VM image or have some build and deploy script depending on your environment or needs.
I'm probably missing some, but that's the basics.
Here is a minimal example that builds a Lisp program into a binary executable with SBCL:
(defun main () (format t "hello, world~%"))
(sb-ext:save-lisp-and-die "hello" :executable t :toplevel 'main)
The SBCL-specific `save-lisp-and-die` function saves the Lisp process as a core image. The `:executable` argument includes the SBCL runtime in the image to ensure that the image is a standalone executable. This is why the executable for even a simple hello-world program tends to be quite large (30 MB to 50 MB)! The `:toplevel` argument specifies which function to run when the core file is run.Here are some example commands to get you started:
$ cat hello.lisp
(defun main () (format t "hello, world~%"))
(sb-ext:save-lisp-and-die "hello" :executable t :toplevel 'main)
$ sbcl --script hello.lisp
$ ./hello
hello, world
If you would rather not have SBCL specific code in the Lisp source code file, then you could move the `sb-ext:save-lisp-and-die` call out of your source file to the SBCL command invocation. The source code now looks like this: (defun main () (format t "hello, world~%"))
The shell commands now look like this: $ cat hello.lisp
(defun main () (format t "hello, world~%"))
$ sbcl --load hello.lisp --eval "(sb-ext:save-lisp-and-die \"hello\" :executable t :toplevel 'main)"
$ ./hello
hello, world
By the way, there is also Buildapp[1] that provides a layer of abstraction for building executables from Lisp programs. It works with SBCL and CCL. It requires the toplevel function to be called with an argument though. Therefore the source code needs to be modified to: (defun main (argv) (declare (ignore argv)) (format t "hello, world~%"))
Then Buildapp can be invoked like this: $ cat hello.lisp
(defun main (argv) (declare (ignore argv)) (format t "hello, world~%"))
$ buildapp --load hello.lisp --entry main --output hello
;; loading file #P"/Users/susam/hello.lisp"
$ ./hello
hello, world
[1]: https://www.xach.com/lisp/buildapp/This is covered on the documentation of CCL and CLISP.
You only need one (1) statement to generate a binary. It's easy.
For Lisp development, Emacs is superior.
There's also SLIMV for VIM, giving the same features.
(declaim (optimize (debug 3)))
in your repl will turn these optimizations off and give you roughly the same debugging experience.And note that if you find its interactive interface very spartan, you're not doing anything wrong. It is very spartan. It's not really meant for direct human use; you're supposed to throw expressions at it from your editor. (Do one thing and do it well and all that.)
$ brew search ccl
==> Searching local taps...
cclive
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
$ brew search clozure
==> Searching local taps...
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
No formula found for "clozure".
Open pull requests:
clozure-cl 1.11.5 (restoration of a deleted formula) (https://github.com/Homebrew/homebrew-core/pull/25768)
Looks like the Homebrew formula for CCL was removed.Then SBCL has superior internal type support in its python compiler, leading to many optimizations. It creates specialized copies of typed methods, and has a nice optimizer framework to deal with that.
Felleisen (Typed Racket) seems to hate types, he summarizes it with types make racket slower, not faster. But he is still developing the only seriously typed scheme effort. Forgot about Stalin, but if I remember correctly it was similar to the CMUCL/python type optimizer.
In my dynamic language I've implemented gradual typing with great success (cperl): more precise, producing better specialized code, faster, detecting more errors at compile-time and better documentation, so I'm sceptical why Felleisen has so many problems. But I implemented it with performance in mind (premature optimization and such), not completeness. Typed php seems also to go well, also the various JavaScript variants. Just scheme, python and ruby not so.
What _can_ be slower is a _mix_ of TR and R. Because TR protects the boundary between the two with runtime contracts. Because it wants safety/soundness.
I'm not any kind of gradual typing expert, but, it seems like you could calibrate speed vs. soundness for boundaries in different ways. TR has prioritized soundness but it seems like you prefer speed.
Similarily SBCL/CMUCL has the similar problem with polymorphic explosion of generating too many methods, which are rarely used. Javascript V8 and friends solved that better.
My speed comes from avoiding consing, my native types are bitfields. Lisp types are usually a class pointer for every cons cell. For me certain casts are permitted, which are not permitted with Typed Racket. So yes, I have to permit traditional code which worked before, esp. with inferred types from literals. Racket has the advantage of defining stricter language subsets, which we only have with Perl 6 also. There you can override even language and type semantics.
Chez has a nice tagging scheme, which should speed up Racket a lot.
Several gradually typed languages don't infer from literals, but that's one of the best speed gains. E.g. the literal 1000 is a union of int32, int64, uint32 and uint64, all possible valid integer types for a certain value. A negative number cannot be unsigned, and a too large number cannot be 32bit. Problem is that people rarely add types, you need to infer 90% of them.
Relevant paper and talk:
http://www.ccis.northeastern.edu/home/types/publications/gra...
(defmethod description ((object integer))
(format nil "The integer ~D" object))
http://lisp-lang.org/learn/clos"Julia: to lisp or not to lisp?": https://www.youtube.com/watch?v=dK3zRXhrFZY
Maybe compare and contrast with Maxima?:
As a side note, I downloaded the Lispworks Common Lisp Hyperspec, but I could only find the HTML version.
I see that the project is on Github, maybe someone will parse the Hyperspec and generate the documentation pages.
I am adding a reminder to my org-agenda for next month, maybe I will attempt to do it :).
> Permission to make partial copies is expressly NOT granted, EXCEPT that limited permission is granted to transmit and display a partial copy the Common Lisp HyperSpec for the ordinary purpose of direct viewing by a human being in the usual manner that hypertext browsers permit the viewing of such a complete document, provided that no recopying, redistribution, redisplay, or retransmission is made of any such partial copy.
Source: http://www.lispworks.com/documentation/HyperSpec/Front/Help....
But I guess you could distribute a script that does the processing.
There's this: https://github.com/LispLang/ansi-spec
Working from the TeX sources seem to be the right way to go especially if the information can get extracted into a generic representation so there could be a HTML / epub / whatever version
Millennials are Killing Common Lisp.
one page, https://www.rust-lang.org/en-US/
The Rust page, on the other hand, only effectively demonstrates one feature, which i don't care about. Unicode strings? Woo. Those belong in separate i18n file. It does so in a box that doesn't even properly display the whole snippet without scrolling. It is cool that I'm able to run it, though of course a newbie like me wouldn't know what to do. Its list of features should be links to examples. As is, the bullet points could have been extracted from a powerpoint presentation and are just as mind-numbing.
[1] though I want a link to more information, for example which servers they chose for Ruby and Node. Were those best-in-class for their language? I'm very suspicious of benchmarks given with little context.
I suspect preconceptions of the language going into the page make a big difference.
Which is not to criticize the Rust page. It is also nice, just different.
I will offer that proclaiming that Millenials are Killing Common Lisp is probably more effective at alienating potential users than a redesigned home page. :(
The stuff above the language description should be shoved to the bottom (excluding obviously the top menu) and it would be perfect. I miss their old site because it was obvious and to the point and had examples right away.
I didn't get RSI scrolling through expansive material space.
Oh, apparently I'm supposed to hover over the images to see more text. Why?!
I had seen a couple of other sites which seemed like they might be that earlier, like https://common-lisp.net/ and the site of the Association of Lisp Users, which I vaguely remember as being at http://alu.org , but now a Google search shows some other sites instead (from the first few hits I looked at). And now there is this one mentioned in the OP. I looked at its About page, http://lisp-lang.org/about/ , but it does not seem to show any such info.
Update: I saw this on the common-lisp.net site:
"This site is one among many gateways to Common Lisp."
which seems to indicate that there was/is no single "(un)official" one.
ABCL was originally used to write and extend an editor called J - but then morphed into a full implementation of Common Lisp.
One can also develop with SBCL - since it has a great compiler - and then move the code to ABCL.
So much innovation has happened since the CLHS that to put up a fluff site feels like an effort of "resurrection". When in reality the Lisp family has continued to evolve since then. To limit yourself to just CL, as I did, for a long time, results a bit of a 'losing my religion'. You'll be confounded by things long since solved, and in the end perhaps write all of "Lisp" off. Do yourself a favor and keep and open mind to the family, and not one common incarnation that predates some developers.
Seriously, the web site is a very informative site about "Common Lisp" - a specific dialect of Lisp. It's right there when you click the link, big letters - "Common Lisp" - you can't miss it.
You could argue about the URL "lisp-lang.org" - but why?
I bought cdr.io years ago when I was seriously into Lisp. If anyone has an idea for it, happy to pass it along.
SBCL works OK on windows, i've used it a lot there.
CCL works perfectly.
ABCL should work just fine.
CLISP works perfectly.
LispWorks and Allegro CL should work perfectly.
My editor of choice is Sublime Text with the SublimeRepl and Parinfer plugins.
This is a great example of why I don't want to use Common Lisp.
Compare with Python:
[word.lower() for word in ("Hello", "world!")]
Beating Node and Ruby in terms of speed is also a big non-argument, with so many attractive programming languages to choose from that are both fast and good looking.
I know both Python and Common Lisp, neither version looks any better than the other to me.
Also, as another commenter notes, the snippets are not actually good translations of each other. Your CL snippet would look like this in Python:
list(map(str.tolower, ("Hello", "world!")))
While your Python snippet would look like this in CL (as pavelludiq notes): (loop for word in '("Hello" "world!") collect (string-downcase word))
Granted, Lisps tend to be a bit more verbose (longer names, less symbols used), which is a natural consequence of having little syntax. It has serious advantages when learning the language or when reading unfamiliar code, although it comes with some drawbacks, too. (mapcar #'string-downcase '("Hello" "world!")) (loop for item in '("Hello" "world!") collect (string-downcase item))Common Lisp is beating on performance surprising number of static languages too. Despite being more dynamic and flexible than any other language.
It beats the majority of programming languages for speed, except for languages known for ultimate speed like C, C++, Rust, Forth, Chapel, and Ada.
This is because Lisp is both high-level and low-level at the same time. This sorcery is possible because of homoiconicity and metaprogramming.
A little more general:
(map 'list #'string-downcase (list "Hello" "world!"))