Skip to content

Instantly share code, notes, and snippets.

@lumie1337
Created June 22, 2020 06:08
Show Gist options
  • Save lumie1337/7e491e92b1e1aa4641261e76503d599e to your computer and use it in GitHub Desktop.
Save lumie1337/7e491e92b1e1aa4641261e76503d599e to your computer and use it in GitHub Desktop.
l1 f (a,b)=(f a,b)
g "inc"=l1 (+1)
g "dec"=l1 (subtract 1)
g "double"=l1 (*2)
g "half"=l1 (`div`2)
g "print"=\(v,s)->(v,s<>show v)
main=interact$snd.foldl (flip g) (0,"").takeWhile (/="exit").words
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment