News Score: Score the News, Sort the News, Rewrite the Headlines

McCarthy's Ambiguous Operator | Random Hacks

Back in 1961, John McCarthy (the inventor of LISP) described an interesting mathematical operator called amb. Essentially, amb hates to be called with no arguments, and can look into the future to keep that from happening. Here’s how it might look in Ruby. # amb will (appear to) choose values # for x and y that prevent future # trouble. x = amb 1, 2, 3 y = amb 4, 5, 6 # Ooops! If x*y isn't 8, amb would # get angry. You wouldn't like # amb when it's angry. amb if x*y != 8 # Sure enough, x is 2...

Read more at randomhacks.net

© News Score  score the news, sort the news, rewrite the headlines