Wednesday, September 20, 2006

Additional Scheming

Up to chapter 4 in the little schemer now. It's interesting to see that most loops are actually done by using recursion ... and it reminds me of another programming language I was taught in University, probably prolog.

I'm not finding the book too hard going and can work out most of the answers to the questions. But I never seem to get the brackets right (as Jani pointed out this is the intially scary thing about lisps) I'm always doing (cons (atom) (atoms)) where it should be (cons atom (atoms)). (>_<) I don't know any of the debugging stuff yet either.

(define spanner
(lambda (lst)
((null? lst) (quote()))
(cons 'spanner
(spanner (cdr lst)))))))

Here is my amazing second entirely homemade function that takes a list and replaces every atom in it with the word (unitialized variable) "spanner". Yay me.

On an unrelated note
This article on stackless python
is quite interesting, the comments are good too.

I've also spent way too much time messing about on a Linux box - it's Ubuntu, easily the most friendly distribution, but I've never ever had an install where I didn't need to compile some C code to get some critical piece of hardware working, if I do ever get it working, that is. It seems unlikely even with the advent of DRM-happy-Vista that Linux is going to widely used on peoples desktops in the near future. I guess if you do happen to have the perfect mix of hardware though Ubuntu is an extremely attractive desktop alternative. Of course there are no games :(

No comments: