Tag Archives: Programming

Cleaning up a set of tags with Awk

Introduction David R. MacIver has recently written this blog post about cleaning up a set of tags. This blog post, on the other hand, is about a nice old Unix tool called ‘awk’. Awk is one of those programs that is often overlooked. It is really a small domain-specific language for processing text. In some [...]

Refactoring in Haskell: Adding an Argument

Just a small tip on this: When you add an argument to a function that already exists you should check the existing usage of the function. Say you have this: f x y z = … … and you want: f x y z w = … First of all you should check the contexts [...]

Music Synthesizer Project (in Matlab)

This post brought to you as part of fulfilling the requirements for Massey University’s 143.363. The brief was to write both an additive and subtractive synthesizer, in addition to an effects processor. I generalized this a little bit so that you can combine random parts together, so the additive/subtractive synthesizers aren’t really separate any more. [...]

Overengineering

Douglas, you’re not alone. import Data.List (sortBy) import Data.Function (on) import Data.Maybe (mapMaybe) import Control.Monad.Instances   gizzabuzz pairs combiner = zipWith ($) (cycle funcs) [1..] where sortedPairs = sortBy (compare `on` fst) pairs funcs = map (\n -> display $ mapMaybe (filterOut n) sortedPairs) [1..foldr1 lcm $ map fst $ sortedPairs] display [] = show [...]