Subject: Re: hallo world in lisp
From: Erik Naggum <>
Date: Tue, 11 Sep 2001 13:31:13 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Luciano Ribichini
> I use Linux (kernel 2.2.x)

  Which distribution?

> I would like to try the LISP language.


> Can you tell me where to find a free/GLP lisp (interpreter, compiler or
> what else) and how to run the lisp variant of the famuos hallo world!
> c-program?

  If you use Debian GNU/Linux, just apt-get install cmucl or clisp.

  The famous C program is famous for its ablity to produce an executable
  with a minimal amount of fuss.  It really shows off the Unix environment,
  and not the language.  However, an executable is only a funtcion that
  resides on disk in the Unix file sysem and which you call from the
  shell's read-execute interactive loop.  Common Lisp systems offer their
  own interactive loop, called the read-eval-print loop and do not
  generally take part in the shell interactive loop the same way other
  languages do.  Some find this a insurmountable obstacle to using Common
  Lisp, others love it.  However, the code for the core program is simple:

(defun hello-world ()
  (write-line "Hello, Lisp world!"))

  Suppose you put this in a file,  To compile it, evaluate

(compile "")

  You now have an object file that can be loaded into the Common Lisp

(load "hello")

  You are now ready to execute the hello-world function:


  If you want to run an "executable" from the shell interactive loop, there
  are many ways to accomplish this, but no standard way.  Suppose you use
  CLISP and have a Linux kernel with misc-binaries support you can do this,
  as root:

echo ":CLISP:E::fas::/usr/bin/clisp:" >> /proc/sys/fs/binfmt_misc/register
echo ":CLISP:E::lisp::/usr/bin/clisp:" >> /proc/sys/fs/binfmt_misc/register

  You can now actually just write

(write-line "hello, Lisp world!")

  into the file hello.lisp and chmod +x hello.lisp and execute it directly.
  Note that you would have to add (hello-world) at the end of the
  file I indicated above to execute anything.