hello, I'm a new lisp newbie

Whatever is on your mind, whether Lisp related or not.
Post Reply
Gradualore
Posts: 3
Joined: Sat Mar 13, 2010 2:10 pm

hello, I'm a new lisp newbie

Post by Gradualore » Sat Mar 13, 2010 2:15 pm

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.

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: hello, I'm a new lisp newbie

Post by nuntius » Sat Mar 13, 2010 3:29 pm

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.

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

Re: hello, I'm a new lisp newbie

Post by Paul Donnelly » Sun Mar 14, 2010 2:08 pm

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.

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: hello, I'm a new lisp newbie

Post by findinglisp » Mon Mar 22, 2010 4:18 pm

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.)
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

william_potter
Posts: 1
Joined: Wed Jan 27, 2010 3:26 am
Location: USA
Contact:

Re: hello, I'm a new lisp newbie

Post by william_potter » Fri Apr 02, 2010 6:06 am

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.

Post Reply