Making (load) work

82 views
Skip to first unread message

Justis

unread,
Feb 6, 2011, 11:04:33 AM2/6/11
to Land of Lisp
Hi,

i'm new to lisp, now reading this marvelous book.. The thing is, i'm
in 8 chapter and i need to use "graph-util.lisp" which was written in
chapter 7 and when i write (load "graph-util") - it kind'a says f u.
And that is normal, because i do not know where i have to put that
file to work as it should.. There is nothing written in the book about
that :S

Justis

unread,
Feb 6, 2011, 11:44:53 AM2/6/11
to Land of Lisp
Ok. Simple thing, silly me it's like in linux - uses my home folder
(now i'm using windows :S)

Purity Control

unread,
Feb 6, 2011, 12:21:50 PM2/6/11
to Land of Lisp
Hi,
I am not sure what environment you are using but if both files are in
the same directory it should work.

Justis

unread,
Feb 6, 2011, 12:37:28 PM2/6/11
to land-o...@googlegroups.com
i'm using clisp as mentioned in book. and i am using clisp over cmd (like run -> cmd -> clisp), and i haven't thought before, that cmd uses "home" directory, like c:\documents and settings\username and that was mi minor problem which is solved.

By the way, lisp is really interesting language, but the thing is about the performance. I think that lisp isn't as fast as c/c++, or am i wrong ? by the way. while reading the book, i thougt that lists in lisp are like arrays in other languages aren't they ? (not in technical specifications, but in general)

( :Justis )

Frank Lavoie

unread,
Apr 20, 2011, 8:09:30 PM4/20/11
to land-o...@googlegroups.com
Hi,

I'm running clisp on Snow Leopard.
I'm also using emacs + slime for development.

I have the same problem. If I move the file in my Home directory, it works fine, but not in the current directory.

Do we need to had files like __init__.py in python or a path variable?

Frank Lavoie

unread,
Apr 28, 2011, 10:25:04 AM4/28/11
to land-o...@googlegroups.com
Can someone knows where I could check for this info? I'm new to lisp and the book is my starting point, I'm a bit lost.

Phil Rand

unread,
Apr 29, 2011, 12:08:46 AM4/29/11
to land-o...@googlegroups.com
On Mac OSX, if I cd to the project directory (in a terminal window -- similar to cmd in windows) before starting lisp, then (load "abc") will load the file abc.lisp in that directory.  I haven't used lisp on windows in years, but I think it was similar.

It turns out that the way Common Lisp handles file names and path names is pretty complicated, because when they were creating the language, and later the standard, they had a major requirement to be compatible with a whole menagerie of operating systems, many of which had very different ways of organizing files.  They had to deal with far bigger differences than the trivial ways Windows and the different Unix-like OS's differ.  These days, it's kind of overkill, but I first learned computers back on PDP-11 minicomputers, and worked on VAX/VMS for years, so I get a little nostalgic when I come across the path complications in lisp.  Conrad chose not to delve too deeply into these issues, probably because it would be tough to do a thorough job without making the book dull and much too long.

Another thing Conrad doesn't mention is the issue of editor support for lisp.  Most lisp programmers use the Emacs editor, with the amazing Slime add-on.  But that is a LOT to learn for a beginner.  I think it was wise to just stay away from that topic.

Someone asked about lisp performance vis-a-vis c or c++.  That's a big topic.  CLISP, the common lisp implementation recommended for the book, compiles to byte-code, in other words, to a virtual machine, like java or .net, but since huge companies haven't been pouring billions of dollars into the CLISP vm, as they have with java and .net, I assume they are much faster.  Other versions of common lisp, for example SBCL, compile to machine code, and so can be quite fast, rivaling c/c++ if carefully tuned.  Of course, that's putting the cdr before the car.  What really wins is the better algorithm, and lisp's flexibility and ease of programming gives the lisper a good chance of finding a better algorithm, if she looks for it.


On Thu, Apr 28, 2011 at 7:25 AM, Frank Lavoie <lav.f...@gmail.com> wrote:
Can someone knows where I could check for this info? I'm new to lisp and the book is my starting point, I'm a bit lost.



--
Phil Rand
phil...@gmail.com
phil...@pobox.com

Phil Rand

unread,
Apr 29, 2011, 12:18:15 AM4/29/11
to land-o...@googlegroups.com
In emacs + slime, in the slime repl, press the comma key, then "pwd" to see your current default directory.  Press comma, then cd and press return, and type a new directory name (tab for completions) to change directories.

Frank Lavoie

unread,
May 3, 2011, 10:45:38 PM5/3/11
to land-o...@googlegroups.com, phil...@gmail.com
thanks but that doesn't seem to work (it throws : READ: comma is illegal outside of backquote)

if I do M-x dired and switch directory it seems to work though

Phil Rand

unread,
May 3, 2011, 11:09:43 PM5/3/11
to land-o...@googlegroups.com
Hmm...  I'm using quicklisp and its slime-helper script to start slime.  I haven't studied that in detail (since it "just works" for me), but it seems to be loading some of the slime contrib packages.  I'm guessing the comma escape for commands comes from in there somewhere.  I highly recommend quicklisp, by the way.


On Tue, May 3, 2011 at 7:45 PM, Frank Lavoie <lav.f...@gmail.com> wrote:
thanks but that doesn't seem to work (it throws : READ: comma is illegal outside of backquote)

if I do M-x dired and switch directory it seems to work though




Reply all
Reply to author
Forward
0 new messages