Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hallo world in lisp

25 views
Skip to first unread message

Luciano Ribichini

unread,
Sep 11, 2001, 6:58:55 AM9/11/01
to
hallo,
I use Linux (kernel 2.2.x)
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 ?

Thanks
Luciano

Friedrich Dominicus

unread,
Sep 11, 2001, 7:46:36 AM9/11/01
to
Luciano Ribichini <r...@mpq.mpg.de> writes:

> hallo,
> I use Linux (kernel 2.2.x)
> I would like to try the LISP language.
>
> Can you tell me where to find a free/GLP lisp (interpreter, compiler or
> what else )

CMUCL, CLISP, the free versions of commercial product (LispWorks, ACL,
MCL and probably some more)


> and how to run the lisp variant of the famuos hallo world! c-program ?

(print "Hello World")

Regards
Friedrich

Erik Winkels

unread,
Sep 11, 2001, 7:49:18 AM9/11/01
to
Luciano Ribichini <r...@mpq.mpg.de> writes:
>
> I use Linux (kernel 2.2.x)

On the off chance that you are running Debian: CMUCL and CLISP are
included in the distribution.


> I would like to try the LISP language.

Enjoy!


> Can you tell me where to find a free/GLP lisp (interpreter, compiler
> or what else )

This might be a good starting point:

http://ww.telent.net/cliki/Common%20Lisp%20implementation

or this:

http://clisp.sourceforge.net/


> and how to run the lisp variant of the famuos hallo world! c-program ?

This will not teach you much, I'm afraid, but here you are:

(format t "~&Hello World!~%")

Here's a link on Lisp books, some of which can be gotten off the net:

http://www.lisp.org/table/learn.htm


cheers,
Erik

Coby Beck

unread,
Sep 11, 2001, 8:49:55 AM9/11/01
to

"Luciano Ribichini" <r...@mpq.mpg.de> wrote in message
news:3B9DEE6F...@mpq.mpg.de...

CL-USER 297 > (defun hey! (&optional (stream *standard-output*))
(format stream "~&Hello World!"))
HEY!

CL-USER 298 > (hey!)
Hello World!
NIL

Coby
--
(remove #\space "coby . beck @ opentechgroup . com")


Janis Dzerins

unread,
Sep 11, 2001, 9:07:09 AM9/11/01
to
Luciano Ribichini <r...@mpq.mpg.de> writes:

Have you tried http://groups.google.com/groups?q=hello+world&hl=en&btnG=Google+Search&meta=site%3Dgroups%26group%3Dcomp.lang.lisp ?

--
Janis Dzerins

If million people say a stupid thing it's still a stupid thing.

Erik Naggum

unread,
Sep 11, 2001, 9:31:13 AM9/11/01
to
* Luciano Ribichini

> I use Linux (kernel 2.2.x)

Which distribution?

> I would like to try the LISP language.

Good!

> 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, hello.cl. To compile it, evaluate

(compile "hello.cl")

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

(load "hello")

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

(hello-world)

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 hello.cl
file I indicated above to execute anything.

///

Friedrich Dominicus

unread,
Sep 11, 2001, 10:29:47 AM9/11/01
to
Erik Naggum <er...@naggum.net> writes:

> 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

Thanks Eric, that's new for me. Well that' really nice. And it works
like a charm.

Regards
Friedrich

Harri J Haataja

unread,
Oct 12, 2001, 4:41:47 PM10/12/01
to
Luciano Ribichini wrote:
>I use Linux (kernel 2.2.x)
>I would like to try the LISP language.
>
>Can you tell me where to find a free/GLP lisp (interpreter, compiler or
>what else )

Couple of (perhaps a bit strange) lisp interpreters may also have sneaked
into your system already - emacs and rep.

--
along with a metric assload of rebar -- Carl Jacobs
What's that in Imperial arseloads? -- Alistair J. R. Young

0 new messages