## Sunday, October 12, 2008

### Replace a sublist within a list with another list

This is just a very short snippet but someone might find this useful.
It took me a while to figure out how to do this right in haskell. In case you know of a better solution please tell me about it in the comment section.
`replaceAll a b c = concat (intersperse b (splitRegex regex c)) where regex = Text.Regex.mkRegex a`

## Tuesday, September 9, 2008

### This is just a prove.

This is just a prove.

## Sunday, September 7, 2008

``age :: (Int,Int,Int) -> (Int,Int,Int) -> Intage (d, m, y) (d2, m2, y2)   | m > m2 = y - y2   | m == m2 && d >= d2 = y - y2   | otherwise = y - y2 - 1``
``max3 , min3, middle :: Int -> Int -> Int -> Intmax3  a b c = max (max a b) cmin3  a b c = min (min a b) cmiddle a b c = max (min a b) (min b c)sort3 :: Int -> Int -> Int -> (Int,Int,Int)sort3 a b c = ((max3 a b c), (middle a b c), (min3 a b c))data Triangle = Failure | Isosceles | Equilateral | Scalene                deriving(Show)analyse :: (Int,Int,Int) -> Triangleanalyse (a,b,c)    | a >= b + c = Failure    | b == c = Equilateral    | (a == b) && (b == a) = Isosceles    | otherwise = Scalenesafe_analyse :: Int -> Int -> Int -> Trianglesafe_analyse a b c  = analyse (sort3 a b c)` `