6 ms·
Not directly related to this cheatsheet, but I was reminded by the section on operators: you can combine multiple binary operators to get something a lot like t
by kenko 14y ago
Not directly related to this cheatsheet, but I was reminded by the section on operators: you can combine multiple binary operators to get something a lot like ternary operators. E.g., in ghci:
Prelude GOA> let True ? x = \_ -> x ; False ? _ = \f -> f
Prelude GOA> True ? 4 $ 5
4
Prelude GOA> False ? 4 $ 5
5
Prelude GOA> False ? 4 $ True ? 3 $ 7
3
Prelude GOA> False ? 4 $ False ? 3 $ 7
7
Pretty neat, I think.
- dons 14y agoWow, GOA, that's a flashback. 2004??
- kenko 14y agoIs it now the mark of the n00b, or something? Or just your own involvement is old?
- wonderzombie 14y agoFTR, I started playing with Haskell early 2012 and I have no idea what GOA is. All I ever see at my prompt is ghci. If this is what GOA is, it actually sounds incredibly useful: http://www.haskell.org/haskellwiki/GHC/GHCi#GHCi_on_Acid http://www.haskell.org/haskellwiki/GHC/GHCi#GHCi_on_Acid. Looking up docs/source for modules? Enumerating typeclass instances? Yes please.
- dons 14y agoI'd forgotten about GOA -- it was a little toy project I came up with to embed lambdabot in GHCi. Looks like it was revived, moved to github, and growing happily. Major flashbacks.