Thursday, 5 August 2010

Programming Praxis

Nothing helps you better at learning the idioms and libraries of a language than actually programming in it. If you're learning by reading a book (which is how I always learn them), the exercises in it (if any) are either not interesting, too trivial or too large (unless you're reading the excellent Little Schemer, which is basically nothing but exercises). So you need to find some problems to program on your own. In the past, I either had no idea what to try, or was way too ambitious.

But this has changed now that I recently discovered the Programming Praxis website. It contains quite a bit of interesting exercises that always have a reference solution in Scheme. People can also post their own solutions (mostly in functional languages though).
I especially liked the Josephus problem, but I have to admit it took me quite a bit of time to come up with an elegant, working solution, only to learn that I came up with the most inefficient of the three proposed reference solutions :)

But at least now I'll never be short for exercises in the future :)

Technorati Tags:

Posted by cvf at 11:15 PM in Development

Wednesday, 19 May 2010

The Little Schemer

I just read the first few chapters of The Little Schemer (the first three editions were know as "The Little Lisper"). It's a classic introduction to the Scheme/Lisp language that is written in a very unique style. Instead of lots of long paragraphs of text, it is written in the form of questions and answers (you can find an example chapter on the homepage of the author here). I really like this style, but the opinions are very mixed if you look at the reviews on Amazon. It seems people either love it or hate it, but not much in between.

After only two pages you know what an atom, a list and an s-expression are. Once those basic building blocks have been introduced, the questions gradually build up, letting you learn about car and cdr (getting the first and all but the first elements of a list), and using those primitives to build other list-manipulating functions.
It's not really a full coverage of Scheme the language, as much as it is an introduction to the programming style and culture that defines Scheme.

A very big part of that culture is recursion, which is the emphasis of the book. Recursion seems to come very natural in Lisp: solving problems in the same style would be unreadable in more imperative languages like Java, but are a thing of beauty in Lisp.
I had never really gotten the fascination with recursion, finding the examples often more complicated than simple loop-based ones, but I'm starting to come around on that after reading this book.

The minimal syntax of Lisp is definitely something you need to get used to. It seems like something of a wonder to me that you can write full fledged programs using only round brackets :). I still think that it would be painful to read through lengthy programs written in it, since it seems to be harder to quickly see the structure of the program. But it's probably also something that grows on you.

All in all, it's nice to be introduced to something that is so alien compared to what I use in my daily programming. I'm also very surprised to see how high level Lisp is, considering it has been around since 1958, which to someone my age is still the dark ages :).

Technorati Tags:

Posted by cvf at 11:05 PM in Development

Sunday, 15 June 2008

Nifty app: Nocturne

If you're like me, you spend quite some time in the total dark behind your computer screens. The only light is coming from your display, but even that may be too much at times.

Recently, I discovered a nifty little app called Nocturne for the Mac (which I'm fortunate enough to use :), that allows you to switch to a "night mode". It basically inverts your display, so all whites turn black and vice versa.

Since a picture says more than a thousand words, I'll display the effect here:

Nocturne enabled:
Nocturne On
Nocturne disabled:
Nocturne Off

You could do the same by creating some color profiles for your apps/os, but that gets tedious quick. The only drawback to this solution is that it is not a very good mode to process your photos at night :)

Technorati Tags:

Posted by cvf at 12:11 PM in Development

« September »
SunMonTueWedThuFriSat
   1234
567891011
12131415161718
19202122232425
2627282930