Live data from Hacker News

Common Lisp homepage

lisp-lang.org

41–50 of 313 posts

Re: Common Lisp homepage

#41
post #32
post #9

Often those who are curious to try Lisp are faced with a number of choices: Which dialect to choose? Which implementation to choose? Which book or tutorial should one follow? Is it necessary use Emacs? SLIME? 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…

What confused me a lot is that nobody seems to give an example on how to build a binary out of a Lisp program/make it runnable from command-line. 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 L…

See this book:

http://weitz.de/cl-recipes/

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...

Re: Common Lisp homepage

#42
post #9

Often those who are curious to try Lisp are faced with a number of choices: Which dialect to choose? Which implementation to choose? Which book or tutorial should one follow? Is it necessary use Emacs? SLIME? 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…

CCL is available from homebrew. You can also simply download the compiler as well as the cocoa based IDE from the App Store.

I can't find CCL in Homebrew.

    $ 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.

Re: Common Lisp homepage

#43
post #32
post #9

Often those who are curious to try Lisp are faced with a number of choices: Which dialect to choose? Which implementation to choose? Which book or tutorial should one follow? Is it necessary use Emacs? SLIME? 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…

What confused me a lot is that nobody seems to give an example on how to build a binary out of a Lisp program/make it runnable from command-line. 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 L…

The reason nobody can give you an example for how to make a binary is because there are many many different ways of doing that. To name just a few:

* 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.

Re: Common Lisp homepage

#44
post #21
post #7

Lisp is quite popular at my current workplace. A few popular open source projects published by our organization have been written in Clojure (a dialect of Lisp that runs on JVM and CLR). A few domain specific languages used internally in our organization are also inspired by Lisp. 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…

I liked clojure when I dived into it but lack of static typing is a pain especially once you have got used to the wonderful refactoring and code-intelligence abilities you get by adopting the tools of static typed programming languages like Java/Go/C#/F#. Also performance!

From the dynamic languages the SBCL compiler is something you might want to try.

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.

Re: Common Lisp homepage

#45

What exactly is meant by the line "Design patterns disappear as you adapt the language to your problem domain." 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…

Indeed Lisps claim to fame is how much the language itself is extensible. Something along the lines of "you rewrite the language / expand it" for whatever project you're working on. Writing your own lisp interpreter is another popular type of project people do as well given how simple Lisps syntax is to parse and follow. If you are interested in Lisp on the JVM check out Clojure.

For Lisp on the JVM there is also ABCL, which is a full implementation of Common Lisp: https://abcl.org

Re: Common Lisp homepage

#46

What exactly is meant by the line "Design patterns disappear as you adapt the language to your problem domain." 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…

Some of the problems in imperative languages are solved with design patterns. You don't have these problems if you use Lisp.

Re: Common Lisp homepage

#48
post #21
post #7

Lisp is quite popular at my current workplace. A few popular open source projects published by our organization have been written in Clojure (a dialect of Lisp that runs on JVM and CLR). A few domain specific languages used internally in our organization are also inspired by Lisp. 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…

I liked clojure when I dived into it but lack of static typing is a pain especially once you have got used to the wonderful refactoring and code-intelligence abilities you get by adopting the tools of static typed programming languages like Java/Go/C#/F#. Also performance!

There is TypedClojure[1] for static typing in Clojure, but I am not quite sure how good the tooling is though, e.g. refactoring, code-intelligence abilities, etc...

[1]http://typedclojure.org

Re: Common Lisp homepage

#49

What exactly is meant by the line "Design patterns disappear as you adapt the language to your problem domain." 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…

Indeed Lisps claim to fame is how much the language itself is extensible. Something along the lines of "you rewrite the language / expand it" for whatever project you're working on. Writing your own lisp interpreter is another popular type of project people do as well given how simple Lisps syntax is to parse and follow. If you are interested in Lisp on the JVM check out Clojure.

And you can change Lisp language on the fly. Think like you can chage "if" in Java.

Re: Common Lisp homepage

#50
post #32
post #9

Often those who are curious to try Lisp are faced with a number of choices: Which dialect to choose? Which implementation to choose? Which book or tutorial should one follow? Is it necessary use Emacs? SLIME? 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…

What confused me a lot is that nobody seems to give an example on how to build a binary out of a Lisp program/make it runnable from command-line. 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 L…

Since Common Lisp is a language standard (not an implementation) it is hard to provide a single set of instructions or guidelines that would work for all implementations. There are various implementations of Common Lisp that target native machine code, C code, bytecode, JVM, etc. So the build instructions, project structure, etc. depend on the target.

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/
Post reply on HN