Why Wikipedia is almost comically awesome

June 14th, 2007  |  Tags: , ,  |  2 Comments

I recently had occasion to visit this Wikipedia article about Alice ML. Alice ML extends Standard ML with a bunch of useful features, like future, typesafe persistence, and so on.

To motivate future, the wikipedia article author presents the recursive Fibonacci function:

fib 0 = 0
   | fib 1 = 1
   | fib n = fib(n-1) + fib(n-2);

The article then states that “[f]or large values of n, fib n will take a long time to compute.” No kidding; it’s exponential with n. However, Alice ML, according to the Wikipedia article, has a solution for this problem — and it’s not the one you learned in CS1. With future, the article informs us, it is possible to spawn a new thread to compute the nth Fibonacci number, thus saving time if the continuation of fib n does not need the result of fib n immediately.

The article neglects to mention that even Standard ML provides a mechanism to dramatically speed this function’s execution: the humble accumulator, whose straightforward application admits an implementation of fib that is linear with n.

Responses

  1. Caleb Bassett says:

    June 14th, 2007 at 07:20:22 PM (#)

    I have no idea what that means. But I will take your word for it. :P

  2. Caleb Bassett says:

    June 18th, 2007 at 09:56:56 PM (#)

    Another thing that cracks me up is when people cite Wikipedia as a definitive source on something, that is, “Wikipedia said X, therefore, we shall assume it is the truth.” Wikipedia is a good source for a lot of information, but it is far from being the final source.

Leave a Response