How to start programming in LISP

Discussion of programming Lisps using Emacs, including SLIME and other tools
Post Reply
nitinkapoor25
Posts: 11
Joined: Mon Jan 05, 2009 10:17 am

How to start programming in LISP

Post by nitinkapoor25 » Mon Jan 05, 2009 11:26 am

Hi All,

I am new in LISP and need your help to start programming in LISP. I have read the basic of lisp about different commands. Please help me to start programming.

Thanks
Nitin

qbg
Posts: 64
Joined: Mon Jun 30, 2008 1:05 pm
Location: Minnesota

Re: How to start programming in LISP

Post by qbg » Tue Jan 06, 2009 1:51 pm

What lisp dialect (Common Lisp, Scheme, etc.) have you been reading up on? If you haven't been focusing on a specific one, then you should before you start writing code. If you need to pick one, Common Lisp might be a good choice.

If you are going to be doing CL, you might want to start reading Practical Common Lisp. You will also need to install a CL implementation (unless you already have one installed). For free software implementations, SBCL is very popular, though its support on Windows is a bit young (should work okay though nowdays). CLISP is another implementation which is nice, and is traditionally the free software implementation for Windows. You could also try Lispbox.

nitinkapoor25
Posts: 11
Joined: Mon Jan 05, 2009 10:17 am

Re: How to start programming in LISP

Post by nitinkapoor25 » Thu Jan 15, 2009 11:33 am

Thanks for your reponse.

I am using Ubuntu (Linux OS). I have already installed below mentioned software for lips:

1. EMACS GNU
2. SBCL
3. CL-SQL
4. Slime

I am trying the file opening in emacs LISP with below mentioned code:

(let ((in (open "/home/administrator/test.el")))
(format t "~a~%" (read-line in))
(close in))

I got T in reply. Didn't understand what it means.

waiting for reply.

Regards
Nitin

Exolon
Posts: 49
Joined: Sat Jun 28, 2008 12:53 pm
Location: Ireland
Contact:

Re: How to start programming in LISP

Post by Exolon » Thu Jan 15, 2009 1:19 pm

Does it not simply mean that the file was closed successfully? (let form evaluates to its last subform, which is (close in), so that returns T (I presume is the emacs lisp equivalent of #t in Common Lisp, i.e. true)... right?)

Wodin
Posts: 56
Joined: Sun Jun 29, 2008 8:16 am

Re: How to start programming in LISP

Post by Wodin » Wed Jan 21, 2009 2:23 pm

Exolon wrote:Does it not simply mean that the file was closed successfully? (let form evaluates to its last subform, which is (close in), so that returns T (I presume is the emacs lisp equivalent of #t in Common Lisp, i.e. true)... right?)
You're thinking of Scheme. T is true in Common Lisp (and I assume it's the same in Emacs Lisp.) Scheme uses #t and #f for true and false.

psismondi
Posts: 13
Joined: Mon Jan 11, 2010 7:48 pm

Re: How to start programming in LISP

Post by psismondi » Mon Jan 11, 2010 7:50 pm

For help learning Common Lisp such as sbcl, also check out David Lamkin's book (online and free):

http://www.psg.com/~dlamkins/sl/

My own favorite beginner's book is Paul Graham's ANSI Common Lisp. But it is not free.

Best,

- Phil -

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: How to start programming in LISP

Post by Paul Donnelly » Wed Jan 13, 2010 10:23 am

nitinkapoor25 wrote:I am trying the file opening in emacs LISP with below mentioned code:

Code: Select all

(let ((in (open "/home/administrator/test.el"))) 
  (format t "~a~%" (read-line in)) 
  (close in))
This isn't Emacs Lisp, this is Common Lisp. Where did you type this? Have you got SLIME set up properly? If you have, you should see the first line of that file printed in your REPL, and then T, since "(close in)" returns T, and that's the last form in your let. It's better to use with-open-file than open/close if you can.

Post Reply