Skip to content

Instantly share code, notes, and snippets.

@elliotpotts
Last active May 2, 2017 17:10
Show Gist options
  • Save elliotpotts/f04fff8dc4a54f74473c726900d88e90 to your computer and use it in GitHub Desktop.
Save elliotpotts/f04fff8dc4a54f74473c726900d88e90 to your computer and use it in GitHub Desktop.
type Var = String
type Z = Int
type State = Var -> Z
emptyState :: State
emptyState = const 0
assign :: State -> Var -> Z -> State
assign oldst name var x = if x == name then value else oldst x
assign' :: State -> Var -> Z -> State
assign' oldst name var = \x -> if x == name then value else oldst x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment