Skip to main content

Posts

Showing posts from November, 2005

Io: A Comparison

I just wrote my first non-trivial program in Io. It felt very comfortable, and I felt productive. I didn't struggle over every square inch like I do in languages like Ocaml. It felt like a weird mix of Lisp and JavaScript. Anyway, the program I wrote is a prime finder--yes, how geeky. Here it is:
#!/usr/local/bin/io

/*
* Find prime numbers. See usage for more information.
*
* Author: JJ Behrens
* Date: Sat Nov 5 19:50:21 PST 2005
* Copyright: (c) JJ Behrens
* Description:
*
* The algorithm used to determine if a given number, n, is prime is to keep a
* list of pairs (p, mc) where each p is a prime less than n and each mc is n
* % p. If n is prime, then no mc is 0. The effeciency of this algorithm is
* wholly determined by how efficiently one can maintain this list. mc does
* not need to be recalculated using a full % operation when moving from n to n
* + 1 (increment and then reset to 0 if mc = p). Furthermore, another
* performance enhancement is to use lazy evaluatio…

Languages: Io

Io

Coroutines, prototype based, asynchronous, futures, minimalistic syntax, 0 keywords, lazy evaluation of function parameters, oh my! This out to keep me entertained for a few days!

As an aside, in this paper, he says:Message arguments are passed as expressions and evaluated by the receiver. Selective evalulation of these arguments is used to implement control flow.Heh, cool, I did the same thing (and was similarly pleased) in my programming language, Squeamish , which I wrote about in Dr. Dobb's Journal :)