Category: <span>Lisp</span>

As a follow-up to a previous post, where I wrote some Linq code to find the two closest factors of a number, I decided to do the same in Racket.

The code was nice, but the execution time was initially very disappointing, until I learnt something interesting about Lisp.

OK, so the title is really misleading, as you can’t really compare two such different languages, but it’s interesting to try to anyway.

Anyway, being a rank beginner, I had to start with everyone’s favourite recursive function, the factorial. This is a good one, as it’s so simple, but quickly generates numbers so big that it’s pretty useless unless you do something more than the basic coding. The results were surprising.