Exploring Programming Languages
I’ve decided to stretch my M4D 5K1LL5 a bit, by implementing the Collatz sequence in several different languages. It’s simple enough to make for reasonably readable code, but complicated enough that I’ll have to do some research to make it actually work in each language. So far, I’ve implemented it in C and Java; I’ve also put Python, Perl, Ada, assembler (AMD64 and maybe SPARC32), Ruby, Lua, Haskell, LISP, FORTRAN, and even COBOL into the list. What the heck, I think I’ll even include Bash (minus the new “enhancements”; I don’t want to make it too easy).
The basic (but not BASIC) idea is to run the program with “progname N”, which will print all the Collatz values from 1 to N. It sounds easy, but each language will present its own challenges. For now, I need to find out how to get command-line values in a LISP program.
Update 2008-08-24 1:40AM EDT: In CLisp, EXT:*ARGS* returns a list of command-line arguments. Every Lisp interpreter has its own form for doing this.