leah blogs

August 2006

16aug2006 · Side-effects in real life

Two years ago today, I’d flip my LSB. Since I’m doing a lot of purely functional programming these days, it’s not as easy like that this year:

import Control.Monad.State

data Guy = Guy { name :: String, age :: Integer }

introduce guy =
    concat ["Hey, I'm ", name guy,
            ", and I'm ", show $ age guy, " years old."]

getOlder :: State Guy ()
getOlder = modify (\guy -> guy { age = (age guy) + 1 })

main =
  let guy = (Guy "chris" 18) in do
    print $ introduce guy
    print $ introduce $ execState getOlder $ guy

Facts: Nineteen is a centered triangular number, centered hexagonal number, and an octahedral number. Every positive integer is the sum of at most nineteen fourth powers. Nineteen is a Heegner number and a strictly non-palindromic number



NP: Ton Steine Scherben—Heute Nacht

Copyright © 2004–2022