Page 1 of 1

hello, I'm a new lisp newbie

Posted: Sat Mar 13, 2010 2:15 pm
by Gradualore
Hello everyone. I recently encountered Lisp at my workplace and was very impressed with what a co-worker of mine was able to do with it. This inspired me to learn it. I think the coolest thing about Lisp is its powerful macro system. I don't know much about it yet nor do I have experience in it but I can easily imagine how useful that can be. I can't possibly count the number of times I wished I could generate code in a more robust way than the C preprocessor or C++ templates can handle. So, I'm looking forward to really learning what it is all about. As I'm writing experimental programs I'm reading Seibel's Practical Common Lisp and also trying to read Graham's On Lisp, though I think I may need a bit more experience to benefit from that book.

Re: hello, I'm a new lisp newbie

Posted: Sat Mar 13, 2010 3:29 pm
by nuntius
I would recommend writing lisp code for a week or so before trying macros. Macros are simply functions that return structures to be interpreted as code; it is easier to write macros after you know how to write code by hand and have some experience manipulating lists in lisp.

Many macros I write are the result of typing the same boilerplate a few times. When the trend becomes obvious, you take one of these copies, stick a backquote in front and a few commas inside, and put it in a macro. More sophisticated macros come when this experience generalizes to more complex patterns.

Its the same process used when splitting code into functions, but at a different level.

Re: hello, I'm a new lisp newbie

Posted: Sun Mar 14, 2010 2:08 pm
by Paul Donnelly
PCL is a good book for people with some programming experience. Be forewarned: you'll try to apply macros in many situations where they're not particularly necessary or appropriate. Any time you think you need a macro, try first to write it as a function instead. Often, wrapping a function with a macro to give it a neater interface when you need one is the best of both worlds.

Re: hello, I'm a new lisp newbie

Posted: Mon Mar 22, 2010 4:18 pm
by findinglisp
Paul Donnelly wrote:PCL is a good book for people with some programming experience. Be forewarned: you'll try to apply macros in many situations where they're not particularly necessary or appropriate. Any time you think you need a macro, try first to write it as a function instead. Often, wrapping a function with a macro to give it a neater interface when you need one is the best of both worlds.
Amen. Good advice. You can write a LOT of good Lisp code without ever reaching for macros. (Of your own, that is. You'll be using standard macros all over the place, but that's neither here nor there to you.)

Re: hello, I'm a new lisp newbie

Posted: Fri Apr 02, 2010 6:06 am
by william_potter
I just got started with the program, luckily I have quite experience using Fortran which I found a bit helpful in learning LISP. I like how it can manipulate source code as a data structure, giving rise to the macro systems that allow us to create new syntax. PCL looks like a good reference as a start, but I think I'm gonna need more resources.