You are here


The Haskell programming language

Oh Haskell

I built some code recently to generate SVG that could be transformed into PDF and then fed to a laser cutter along with a bamboo sheet to get markers for the Glass Plate Game. (This is why I cared about X DPI: I wanted to see what the markers would look like "actual size".)


A Logo demo in Haskell

Ran across the homepage of Berkeley Logo a few days ago. One of the things on there is this demo code

to choices :menu [:sofar []]
  if emptyp :menu [print :sofar stop]
  foreach first :menu [(choices butfirst :menu sentence :sofar ?)]

When invoked as

choices [[small medium large]
         [vanilla [ultra chocolate] lychee [rum raisin] ginger]
         [cone cup]]

we get a list of choices starting with

small vanilla cone
small vanilla cup
small ultra chocolate cone
small ultra chocolate cup

I got curious about how Haskell stacks up against Logo here…


Exploring Haskell's concatMap performance

I put some code and results up on BartForge yesterday. I've been exploring the performance of Haskell's concatMap function as part of learning how to write performant Haskell code. I saw some interesting things in the process: read the writeup for details. Fob


Huffman Encoding in Haskell

I guess that after doing run-length encoding, the next logical step was Huffman encoding. Find my project at BartForge. It encodes and decodes about 2M symbols per second on my fast box.

I'm slowly learning how to optimize Haskell. Bleah. Fob


Run-Length Encoding in Haskell

I was messing around with some code for run-length encoding and decoding over the past couple of days, and with the help of Jamey Sharp, Josh Triplett, and Jules Kongslie got it to be constant-time per symbol and fast.

Get the code at BartForge. Fob


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…


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


Laziness weirds programming. Fob


An Audio Compressor / Limiter

I posted an audio compressor / limiter written in Haskell to HackageDB and BartForge this weekend. I also posted its ancillary pure-Haskell WAVE file IO library, and my Haskell argument parsing library.

It all still needs a lot of work to be good, but it's usable now. Enjoy. Fob


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]



CODE: Haskell non-transitive dice constructor

I'm slowly learning Haskell. Today's project was something that arguably should be way faster for a fluent Haskell programmer than for a C programmer. It wasn't for me, since I'm still learning the language.

The recent BoingBoing posting on "nontransitive dice" is something I'd seen before and found interesting…



Subscribe to RSS - Haskell