Refactoring in Haskell: Adding an Argument

code,tips 10 December 2008 | 0 Comments

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 [...]

Tagged in , , , , , ,

Music Synthesizer Project (in Matlab)

code,university 24 October 2008 | 4 Comments

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. [...]

Tagged in , , , , ,

Overengineering

replies 27 February 2008 | 0 Comments

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 [...]

Tagged in , , , , ,

A simple BigNum library for .NET

code 13 October 2007 | 7 Comments

Update Due to minor demand, the code is also available: BigNum source. Please note that I haven’t actually touched the code since it was first written. I’m sure there’s some things that don’t work properly. If you’re doing anything big with this you probably want to write some ‘destructive’ update functions for adding, etc. At [...]

Tagged in , , , ,