I've been through many tutorials, primers, how-tos, and whatnot. I've
learned the Lisp syntax and the existance (yet not fully the function)
of macros...
What simple (or series of) quick hacks or programs do you recommend to
try making to fully grasp Lisp?
--
Tordek, dwarven warrior
Tordek wrote:
> I've been through many tutorials, primers, how-tos, and whatnot. I've
> learned the Lisp syntax and the existance (yet not fully the function)
> of macros...
> What simple (or series of) quick hacks or programs do you recommend to
> try making to fully grasp Lisp?
>
> --
> Tordek, dwarven warrior
Try thinking of a feature Lisp doesn't have, and then add it; this will
teach you a great deal about how Lisp works and just how extensible it
is.
I'm also learning a lot from writing a simple DSL (domain specific
language) for text adventures.
Tordek wrote:
> I've been through many tutorials, primers, how-tos, and whatnot. I've
> learned the Lisp syntax and the existance (yet not fully the function)
> of macros...
> What simple (or series of) quick hacks or programs do you recommend to
> try making to fully grasp Lisp?
That is a common mistake. The application does not reveal Lisp, simply
programming does. Lisp is not a special-purpose language, nor does some
magical feature set it off from the crowd.
Don't you have an application you would like to do?
The Unbearable Powerfulness of Lisp emerges from many small wins (and a
couple of big ones). Which is why "full grasp" is (a) approached, not
reached (b) along a gray scale, not with a thunderclap.
btw, one great thing you could do to achieve your goals and contribute
to Lisp at the same time would be to take the favorite missing library
of your choice for which a C library exists and create a cl-<missing>
wrapper. The first task is creating CFFI bindings -- once you can do
that it is no longer true that Lisp lacks libraries. The next step will
be Lisp-ifying the library with macrology to handle boilerplate
requirments of said library. eg, OpenGL does not like nested glBegins
and requires a glEnd for every glBegin. So I made a with-gl-begun macro
that enforced the first and handled the second.
If every noob was doing this instead of whining about missing libraries
there would not be any.
kzo
--
The Dalai Lama gets the same crap all the time.
-- Kenny Tilton on c.l.l when accused of immodesty
Ken Tilton wrote:
>
>
> Tordek wrote:
>
>> I've been through many tutorials, primers, how-tos, and whatnot. I've
>> learned the Lisp syntax and the existance (yet not fully the function)
>> of macros...
>> What simple (or series of) quick hacks or programs do you recommend to
>> try making to fully grasp Lisp?
>
>
> That is a common mistake. The application does not reveal Lisp, simply
> programming does. Lisp is not a special-purpose language, nor does some
> magical feature set it off from the crowd.
>
> Don't you have an application you would like to do?
>
> The Unbearable Powerfulness of Lisp emerges from many small wins (and a
> couple of big ones). Which is why "full grasp" is (a) approached, not
> reached (b) along a gray scale, not with a thunderclap.
>
> btw, one great thing you could do to achieve your goals and contribute
> to Lisp at the same time would be to take the favorite missing library
> of your choice for which a C library exists and create a cl-<missing>
> wrapper. The first task is creating CFFI bindings -- once you can do
> that it is no longer true that Lisp lacks libraries. The next step will
> be Lisp-ifying the library with macrology to handle boilerplate
> requirments of said library. eg, OpenGL does not like nested glBegins
> and requires a glEnd for every glBegin. So I made a with-gl-begun macro
> that enforced the first and handled the second.
I meant to say that eventually you will find many small ways Lisp makes
life with <missing> easier. Mind you, some of this will come only if you
pick a popular/cool library and experienced Lispniks come along to
give you some ideas.
kzo
--
The Dalai Lama gets the same crap all the time.
-- Kenny Tilton on c.l.l when accused of immodesty
Personally I wrote something I always write when learning a new
language, something that counts the word frequency in a text file. By
the time you've done that you've figured out string handling, basic
data structures and sorting, basic input and output.
I also had a bunch of programming tests from last time I was looking
for a job, and did some of the more interesting ones in there.
Justin
Ken Tilton <·········@gmail.com> writes:
> If every noob was doing [ffi-bindings to C libraries] instead of
> whining about missing libraries there would not be any.
There's a slight problem with that. A "noob" doesn't, by definition,
have any grasp about CL "style", so the interfaces thus created are
likely to be pretty un-lispy, so non-noobs probably will not want to
use them.
Regards,
',mr
--
rydis (Martin Rydstr�m) @CD.Chalmers.SE http://www.rydis.se
[Emacs] is written in Lisp, which is the only computer language that is
beautiful. -- Neal Stephenson, _In the Beginning was the Command Line_
Martin Rydstr|m wrote:
> Ken Tilton <·········@gmail.com> writes:
>
>>If every noob was doing [ffi-bindings to C libraries] instead of
>>whining about missing libraries there would not be any.
>
>
> There's a slight problem with that. A "noob" doesn't, by definition,
> have any grasp about CL "style", so the interfaces thus created are
> likely to be pretty un-lispy, so non-noobs probably will not want to
> use them.
Absolutely.* You may have missed my followup clarification:
"I meant to say that eventually you will find many small ways Lisp makes
life with <missing> easier. Mind you, some of this will come only if you
pick a popular/cool library and experienced Lispniks come along to
give you some ideas. "
So if some noob announces cl-speech (text-to-speech synthesis) it may
suck at being Lispy, but if it works at all I for one will be on it like
ugly on an ape offering contribs. The macrology is the fun part, not so
much the "hello world" bit of just getting a Lisp program to get a C
library merely, well, to speak "Hello, world.".
kt
* Well, the noob said "I've been through many tutorials, primers,
how-tos, and whatnot", so I would not be so sure that they would turn
out garbage. Don't forget, Lisp is not especially hard to learn.
--
The Dalai Lama gets the same crap all the time.
-- Kenny Tilton on c.l.l when accused of immodesty
"Tordek" <······@gmail.com> writes:
> I've been through many tutorials, primers, how-tos, and whatnot. I've
> learned the Lisp syntax and the existance (yet not fully the function)
> of macros...
Good.
> What simple (or series of) quick hacks or programs do you recommend to
> try making to fully grasp Lisp?
For me it has been
Kenny Tilton's "Cells" <http://common-lisp.net/project/cells/>
and
SLIME <http://common-lisp.net/project/slime/>
There's much to explore on <http://www.cl-user.net> also.
Learned a lot from those. Oh, btw, I haven't learnt that much from
quick hacks.
>
> --
> Tordek, dwarven warrior
Frank, Real Person with a Real Life.
For me I think the light kind of came on.
Like yourself I'd read the stuff and tried some but when I got to write
a big project was when I really "saw the light of Lisp", it was quite
an experience.
Think of it like climbing a very steep mountain, getting to the top and
then spending the rest of your life going down the other site.
Paul
http://hyperstring.net
http://search.hyperstring.net
"Tordek" <······@gmail.com> writes:
> I've been through many tutorials, primers, how-tos, and whatnot. I've
> learned the Lisp syntax and the existance (yet not fully the function)
> of macros...
> What simple (or series of) quick hacks or programs do you recommend to
> try making to fully grasp Lisp?
I've always thought that writing a little lisp interpreter, in lisp of
course, for your own use could be a good idea to possess better the language...
Guillaume R. wrote:
> I've always thought that writing a little lisp interpreter, in lisp of
> course, for your own use could be a good idea to possess better the language...
Agree. After learned the basic of lisp, I began studying these open
source
interpreters, they are almost all in C though. But I really get more
understanding
of lisp language.
"Tordek" <······@gmail.com> writes:
> What simple (or series of) quick hacks or programs do you recommend to
> try making to fully grasp Lisp?
Well, I would suggest writing a simple symbolic differentiation program
in Lisp. It would take standard sorts of Lisp algebraic expressions and
produce the differentiation. (I'd skip simplification, though, since
it's a much harder problem.)
(differentiate '(+ (* 2 x) (* x y)) 'x) => (+ 2 y)
(differentiate '(+ (* 2 x) (* x y)) 'y) => (+ 0 x)
(differentiate '(* 2 (expt x 3)) 'x) => (* 2 (* 3 (expt x 2)))
or something along those lines.
--
Thomas A. Russ, USC/Information Sciences Institute
(message (Hello 'Thomas)
(you :wrote :on '(16 Jan 2007 14:15:48 -0800))
(
TAR> Well, I would suggest writing a simple symbolic differentiation
TAR> program in Lisp. It would take standard sorts of Lisp algebraic
TAR> expressions and produce the differentiation.
TAR> (differentiate '(+ (* 2 x) (* x y)) 'x) => (+ 2 y)
TAR> (differentiate '(+ (* 2 x) (* x y)) 'y) => (+ 0 x)
TAR> (differentiate '(* 2 (expt x 3)) 'x) => (* 2 (* 3 (expt x 2)))
TAR> or something along those lines.
here's simple diff for + and *:
(defun diff (expr var)
(cond
((and (consp expr) (eq (car expr) '+))
(cons '+ (mapcar (lambda (x) (diff x var)) (cdr expr))))
((and (consp expr) (eq (car expr) '*))
(cons '+ (loop
with l = (cdr expr)
with ll = (length l)
for i from 0 below ll
for (ct . rest) on l
for before = (butlast l (- ll i))
when (not (numberp ct))
collect (cons '* (append before (list (diff ct var)) rest)))))
((eq expr var) 1.0)
(t 0.0)))
TAR> (I'd skip
TAR> simplification, though, since it's a much harder problem.)
without simplification differentiation is almost useless..
for my (relatively simple) formulas i've made a simplificator that 10 times
more complex than diff. at top level it looks like that:
(defun optimize-expr (expr)
(flatten-expr
(collect-common-factors
(find-factors (flatten-expr (collect-common-factors
(flatten-expr (find-factors (flatten-expr expr)))))))))
i agree that some symbolic algebra lib would be nice. i didn't find one
before, so i wrote some pieces myself for one of my experiments..
if somebody's going to make a lib, i can donate more-or-less working
simplificator, i'm not sure it worth much though..
)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"People who lust for the Feel of keys on their fingertips (c) Inity")