Tech

Everything broke at once

I woke up yesterday morning in Tuscon. A lovely day…

Laziness weirds programming 2

This is a pretty clean definition of the Sieve of Eratosthenes in Haskell. Type it at the ghci command line and evaluate it to get a large list of primes before you get bored…

Nicholas Negroponte on OLPC

From this Negroponte email:

Sugar is a very good idea, less than perfectly executed. I attribute our weakness to unrealistic development goals and practices. Our mission has never changed. It has been to bring connected laptops for learning to children in the poorest and most remote locations of the world. Our mission has never been to advocate the perfect learning model or pure Open Source. I believe the best educational tool is constructionism and the best software development method is Open Source. In some cases those are best achieved like the Trojan Horse, versus direct confrontation or isolating ourselves with perfection. Remember the expression: perfection is the enemy of good. We need to reach the most children possible and leverage them as the agents of change. It makes no sense for us to search for the perfect learning model.

I have no comment here—I'd be interested to hear what others think of this paragraph, though. Friend of Bart

Laziness Weirds Programming

So I thought about it tonight and figured out that in Haskell I can generate the Fibonacci sequence using the definition

let l = [1,1] ++ zipWith (+) l (tail l)

If you type this at ghci you can say "take 20 l" and get

[1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765]

Laziness weirds programming. Friend of Bart

In Haskell we say...

From this interesting blog post:

Where in C++ we might say:
  for (int x = 0; x < 10; x++) f(x)
in Haskell we would say:
  map f (take (10 [0..]))

Which is sadly all too often true. I'm definitely one of the ones who will tend not to find the much happier

map f [0..9]

Friend of Bart

Syndicate content