News for hackers. Stuff that matters.
Re:IF-less programming by tomjakubowski on Saturday December 29, 2012 @03:28AM (#4981523)
You did say that only Lisp implements "if" as a function, but I thought I'd share that in Haskell "if" is syntactic sugar for a case expression. That is:

  if x then y else z
is sugar for:

  case x of
    True -> y
    False -> z
There have been suggestions to replace this sugaring with a proper "if" function, e.g.:

  if :: Bool -> a -> a -> a
  if True x _ = x
  if False _ y = y
to remove arguably redundant syntax, but it seems unlikely that this change would happen. See more here: http://www.haskell.org/haskellwiki/If-then-else

There are no comments on this comment yet.