Confused? Type help



> blog post The UCW school of hard knocks

The UCW school of hard knocks
Tue, 21 Feb 2006 17:21:51

Sure you can learn lisp by starting with the language specification and working your way up from there but it is not exactly in your face is it. It's not of today. We who want to learn want to be sent home crying nowadays by panel of masochistic has beens. I feel that computerlanguage learning should keep up with this degrading trend if we want to have any chance of attracting the youngsters of today. That's why i want to show a route to lisp with a bit more streetcred. Enter the UCW school of hard knocks.

It's a webframework, UCW. Nothing more hip than a webframework. It's hip enough for me anyway. Ai, didn't mean to say hip. But i really like it as a mentor. Initially it is more of a meta-tutor: Step one for your average clueless lisp newbie is downloading the source-code and start staring at those parenthesis. If the only syntax you can distill is that they should match, it's time he should read the theoretical chapters of Practical Common Lisp.

Ah ok, i'll admit. It's me i'm talking about. Let's keep this text honest. And i read those chapters before I downloaded UCW. But afterwards i knew i didn't need more education and i could start coding. But i wanted to do it in UCW so at least i should read the source code. I stumbled into the html-generating code and got hit by a mother of a macro. With my tail between my legs i backed off, leaving some pee behind. My pride was hurt but i had to accept my ineptness. So i downloaded On Lisp and i read the first couple of theoretical chapters to get to grips with those scary lisp monsters. Very pretty code in there. And i curse it, for now i will never want to program in a lesser language again. Oops, did i say lesser? Curse you Graham!

More humbly now i approached UCW. I had Seibel sitting on one shoulder and Graham on the other. I felt stronger now but how could i know what would lie in the belly of the beast? I took a detour and came across a dependency, parenscript (UCW version). It has a nice manual and it supplies us with a nice lisp wrapper for Javascript. A few pages into the manual i realized it would maybe be handy to actually know Javascript to make web apps instead of guessing your way around XMLHttpRequest. So i picked up Javascript the Definitive Guide, which gives a nice overview of the language. Javascript feels a bit like lisp-lite with it's closures and all, but reading it after a lisp tutorial spoils the fun big time because unfortunately i already oversee programming-space from the entrenched-language-adherent-perspective (ELAP). Once again i sort of stopped halfway through the book, just after the core language explanation. Once again i eyed UCW...

In On Lisp i read something about continuations and i knew UCW used the concept so I thought that route was kind of safe. Stopping in front of them revealed they were exactly the kind of continuations Graham didn't touch upon: The ones using a code walker. There wasn't that much introductionary material for this one unfortunately but as i noticed, but i figured usually Bill Clementson has an interesting post or two about a subject like this, and well he didnt let me down. The last link brings you to what i was searching for Macroexpand-all: An Example of a Simple Lisp Code Walker. It's pre-ansi and so some techniques are made redundant, not to mention the purpose of the thing, but the principle is tries to convey is still sound.

Back to UCW again!! This time i actually went back to the topic i left when leaving my meta-teaching-environment. And indeed the UCW code-walker sort of functioned like the one in the example. Or i guess. It does the special form lookup thing in a lookup table and then returns a function to handle it, but as you might expect it does a bit more that macroexpand. I was glad the spagetti made some sense to me but not far in the file i hit another bump: mop. And i thought bad thoughts. Will the list of fancy lisp utensils never stop?? Again an online tutorial was hard to find, but User-Level Language Crafting: Introducing the CLOS Metaobject was rather nice I thought.

This brings the time pointer to about a week ago. Mind you, by this time I still had written zero constructive lisp code, and I hardly read any UCW code. But the time was well spent because the concepts learned are of such a beauty that they make grown men weep. Also i can now sort of understand the ucw code and i can almost advance to semester two of the UCW school of hard knocks. For proper advancement i want to go through the source-code of Dojo which is now used by UCW itself, but i'm getting a bit impatient. The last couple of days i browsed UCW's form handling routines and i got hit by the latest UCW knock. Mr Baringer (ucw creator) banished the code to a seperate library and came with a more pragmatic approach. But again reading the code has it's own benifits. In one of the removed files i came across this macro, and your clueless newbie got a bit confused by the setf tactic:

(defmacro with-simple-restore (places &body forms)
  "Preserve values of setfable PLACES before execution of the FORMS
   and restore them after. Returns the result of the FORMS."
  (let ((keepers (mapcar #'(lambda (p) (declare (ignore p)) (gensym))
                         places)))
    `(let ,keepers
       (setf (values ,@keepers) (values ,@places))
       (prog1
           (progn ,@forms)
         (setf (values ,@places) (values
,@keepers))))))
But appearently it's perfectly legal to first supply setf with a slew of values and after that a slew of places with (values ...). I wouldn't have thought of that one and yet it makes perfect sense.

Anyway this concludes my initial survey of the UCW school of hard knocks. All resources but the javascript book are to be found for free online through legal means. Nice for the coder on a budget. On a personal note i'm happy to say that i just broke my leg so finally i've got some actual time to spend on this education. Also a second-hand copy of Common Lisp The Language 2nd edition was delivered today on my doorstep by global priority mail. This undermines a bit the premise of the first paragraph of course but i doubt any reader actually got this far.


comments

on Tue, 21 Feb 2006 18:19:40 ydl said:

This undermines a bit the premise of the first paragraph of course but i doubt any reader actually got this far.

Ha! You wish... ;)


on Tue, 21 Feb 2006 18:21:37 dkl said:

Enlightening... to and old lisper. Thanks. (Sorry about the leg, though.)


on Tue, 21 Feb 2006 21:49:47 nitpicker said:

It's "Seibel" and "Clementson".


on Wed, 22 Feb 2006 02:00:14 ties said:

It's "Seibel" and "Clementson".

ai, ai, shamefull. I hate when that happens.


on Wed, 22 Feb 2006 05:48:06 hoan said:

Just keep ploughing through those books, they are good. Keep it up. And yes UCW is the school of hard knocks.


on Wed, 22 Feb 2006 07:55:50 henrik said:

Is this really honest? :-) If I wrote this I'd have to include learning unix, emacs, slime, asdf, apache, mod-lisp as well. But of course it's worth it! Thanks for the references, if I may add one it's a javascript site that's pretty good. Now I'll go order cltl2 and read dojo.


on Sat, 25 Mar 2006 06:07:37 hard indeed said:

funny post. you're doing more than fine with just a few months into lisp and ucw.

pick your battle wisely. i give up on ucw after 2 months of trying to understand the code. cps interpreter and mop are the show stoppers for me


on Fri, 09 Feb 2007 10:49:42 Cadar said:

nice post! I'm taking the same lisp-journey and recognise the reading-marathon that one have to put in. The fun thing is when you realise that you are moving forward. My short time goal is to put my first app on the web! You will See when it happens.

The prime number-thing was to hard for me, I had make a lispprogram solve it.. why think when you can make the computer do it for u.


on Tue, 21 Aug 2018 13:01:36 comment said:

comment


on Tue, 21 Aug 2018 13:01:51 comment said:

comment


on Tue, 21 Aug 2018 13:02:22 comment said:

comment


Want to comment? Type comment. Type something else to randomy chat a bit. I won't bite.
>