hello, I'm a new lisp newbie
-
- Posts: 3
- Joined: Sat Mar 13, 2010 2:10 pm
hello, I'm a new lisp newbie
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
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.
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.
-
- Posts: 148
- Joined: Wed Jul 30, 2008 11:26 pm
Re: hello, I'm a new lisp newbie
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.
-
- Posts: 447
- Joined: Sat Jun 28, 2008 7:49 am
- Location: Austin, TX
- Contact:
Re: hello, I'm a new lisp newbie
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.)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.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
-
- Posts: 1
- Joined: Wed Jan 27, 2010 3:26 am
- Location: USA
- Contact:
Re: hello, I'm a new lisp newbie
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.