Writing an assembler turns out to be an interesting example: one needs to calculate distances between jumps and their target labels, and the target may appear after the label. It turns out that one can write a one-pass assembler using the tardis monad or in Curry, using logic programming.
For an array with dimensions \(n_1,n_2,\ldots n_r\) stored in column-major order, an element with indices \(a_1,a_2,\ldots a_n\) is located at offset
In Haskell, one can present a streaming compression/decompression API with lazy bytestrings.
One can define a Num
instance in Haskell for ASTs of expressions, viz.
Haskell programmers have an undue reputation for writing obfuscated code, perhaps due to the fondness for pointfree code and higher-order functions. However the commitment to terseness is dubious at best; syntax is rarely exploited.
next