Monday, January 18, 2010

Here is 99 bottles of beer in Parenthesis Hell.

((())((((())(()))(()()())(((())))((()()())(((()))((())))(((())()
)(((())(()))((())())(((()))((())))(()()))(()())((())))(()()())((
()())((())))(((())())(())((())(()))((())())((()())((())))(()()))
(()()))(()()))((()((()()(()()()((()(()()(()((()()(((()((()(()()(
()(((()(()()())))))))))))))))))))))(()()())()((()()())(((())))((
()()())(((()))((())))((()()())(((()))((()))((())))((()()())(((()
))((()))((()))((())))((()()())(((()))((()))((()))((()))((())))((
()()())(((()))((()))((()))((()))((()))((())))((()()())(((()))(((
)))((()))((()))((()))((()))((())))((()()())(((()))((()))((()))((
()))((()))((()))((()))((())))(()()()(((()()(())))))()()()(((()()
()()))))()()()((()(((()))))))()()()((()((()())))))()()()((()(()(
())))))()()()((()(()()()))))()()()((()()((())))))()()()((()()(()
()))))()()()((()()()(()))))()()()((()()()()())))((()((()()()((()
((()((((()(((()(()(()((()(((()()(((()(()()()))))))))))))))))))))
)))))(()()())(((())))(((())(()))((())())((()((()()(()()()((()(()
()(()((()()(((()((()(()()(()(((()(()()())))))))))))))))))))))(((
))))(()((()()(()()()((()(()()(()((()()(((()((()(()()(()(((()(()(
)())))))))))))))))))))))(()()))(()()())((()()))((()((()()(()()()
((()(()()(()((()()(((()((()(()()(()(((()(()()())))))))))))))))))
))))(()()))()()((()(((()()((()((((()()(()()()()()()((()((()(()((
()((((()(((()()(()()((()()(()(()))))))))))))))))))))))))))))))))
((()(()()()()((()((()((((()(((()(()(()((()(((()()(((()(()()())))
)))))))))))))))))))))(()()())(((())))(((())(()))((())())((()((()
()(()()()((()(()()(()((()()(((()((()(()()(()(((()(()()()))))))))
)))))))))))))((())))(()((()()(()()()((()(()()(()((()()(((()((()(
()()(()(((()(()()())))))))))))))))))))))(()()))(()()())((()()))(
(()((()()(()()()((()(()()(()((()()(((()((()(()()(()(((()(()()())
))))))))))))))))))))(()()))()()(()()(((()()((()((((()()(()()()()
()()((()((()(()((()((((()(((()()(()()((()()(()(())))))))))))))))
))))))))))))))))((()(((()()((()))))))(()()())(((())))(()()(((()(
)((()))))))(()()())((()()))((()()())(((()))(()()))(()()(((()()((
()))))))()())()()(((()()((()))))))((()((()()()(()()((()((((()(((
()(()()()(((()(()()()((()((()()()((()()(()(()(((()()((()))))))))
)))))))))))))))))))))))((())(()))((())())((()((()()()((()((()(((
(()(((()(()(()((()(((()()(((()(()()()))))))))))))))))))))))))))(
(())(()))((())())(()()()(()()()()()()((()()()(()()((()((((()((((
)(()()()(((()(()()()((()((()()()((()()(()(()))))))))))))))))))))
)))))))((())(()))((())())((()(((()()((())))))))()()()(()()()()()
()((()((((()((()()((()()()(()()()()()()((()()()(()()((()()(()(()
((()()(()(()(((()()(()()))))))))))))))))))))))))))))((()(()()()(
)(()()((()((((()(((()(()()()(((()(()()()((()((()()()((()()(()(()
(((()()((()))))))))))))))))))))))))))))))((())(()))((())())((()(
()()()()((()((()((((()(((()(()(()((()(((()()(((()(()()()))))))))
)))))))))))))))))((())(()))((())())(()()()(()()()()()()((()()()(
()()((()((((()(((()(()()()(((()(()()()((()((()()()((()()(()(()))
)))))))))))))))))))))))))((())(()))((())())((()(((()()((()))))))
)()()()(()()()()()()((()((((()((()()((()()()(()()()()()()((()()(
)(()()((()()(()(()((()()(()(()(((()()(()()))))))))))))))))))))))
))))))((()((()()(()()()((()()(()(()((()()()((()))))))))))))(()()
())((()()))(((())())(((())))((()))(()()))((())())(((()))((())))(
)((((((((())))))))))((()(((()((()()()((()()()(())))))))))((())((
)))((())())((()(()()()()(()()((()((((()(((()(()()()(((()(()()()(
(()((()()()((()()(()(()(((()()((()))))))))))))))))))))))))))))))
)((())(()))((())())(()()()(()()()()()()((()((((()((()(((()()()((
)()()()()()(((()(()()()((()(()()()()((()()(()(()()(()()()()()()(
((()(((()((()()()()(()((()((()()()((()((()()()()(()((()()()()(()
()()()()())))))))))))))))))))))))))))))))))))))))))))))))((())((
)))((())())((()((()()()(()()((()((((()(((()(()()()(((()(()()()((
()((()()()((()()(()(()(((()()((())))))))))))))))))))))))))))))))
)(()()())(((())))((()(((()((()()()((()()(()())))))))))(()((()()(
()()()((()()(()(()((()()()((())))))))))))))(()()())((()()))((()(
((()((()()()((()()(()())))))))))(()((()()(()()()((()()(()(()((()
()()((())))))))))))))()()()(()(((()()()()()(()(()()(()()()(((()(
(()((((()()(()()()()()()(((()(()()()((()((((()()(()()()()()()(((
()(()()()((()(()()()()((()()(()(()()(()()()()()()(((()()((()((((
)(()()()((()((((()(((()()(()()((()()(()(()()(()()()()()()((()()(
)()(()((()(((()()((()()(()()()()(()()()()()()((()()()(()()(((()(
()(()((((()()(()()(()()()()()()(((()()((()((()((((()((()((()(()(
(()()(()(()()(()()()()()()((()((()(()((()((((()(((()()(()()((()(
)(()(()()(()((()()()()(()()()()()()()(((()()(()()(((()()(()()(()
()()()()()((()()()(()()((()((((()(((()(()()()(((()(()()()((()(((
)()()((()()(()(()(((()()((()()(()()()()()()((()((((()((()()((()(
)()(()()()()()()((()()()(()()((()()(()(()((()()(()(()(((()()(()(
)()(()()()()()()((()((((()((()(((()()()(()()()()()()(((()(()()()
((()(()()()()((()()(()(()()(()()()()()()(((()(((()((()()()()(()(
(()((()()()((()((()()()()(()(((()()()()()(()(()())))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))((()(((()((()()()((()(
)(()())))))))))((())(()))((())())(()()()(()(((()()()()()(()(()()
(()(()(()()()((()()()()(()((()(()((()((()()(()(()()(()()()()()()
((()((((()((()(((()()((()()(()(()()(()()()()()()((()()(()()()(((
)((((()(((()(((()((()(((()()()(()()()()()()((()()()()(()((()((((
)()((()()(()()()()(()()()()()()(((()()()()()((()()()()(()(((()()
((()(((()()((()()(()()()()()()((()(()()(()(((()(()()()()(()()()(
)()()((()()()()(()(((()()(()()((()((((()(((()(()(()((()(((()()((
()()(()()()()(()((()()()()(()()()()()())))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))((())(()))((())())((()(((
)()()(()()((()((((()(((()(()()()(((()(()()()((()((()()()((()()((
)(()(((()()((()))))))))))))))))))))))))))))))))()()()(()()()()()
()((()((((()((()(((()()()(()()()()()()(((()(()()()((()(()()()()(
(()()(()(()()(()()()()()()(((()(((()((()()()()(()((()((()()()(((
)((()()()()(()(((()()()()()(()(()()()()()(()(()())))))))))))))))
))))))))))))))))))))))))))))))))))))((()(((()((()()))))))((())((
)))((())())((()(((()((()()()((()()()(()))))))))))(()()())(((()))
)((()(((()((()()))))))(()((()()(()()()((()()(()(()((()()()((()))
)))))))))))(()()())((()()))((()(((()((()()))))))(()((()()(()()()
((()()(()(()((()()()((())))))))))))))()))(()(((()((()()))))))()(
((((((((())))))))))((((((((())))))))))

I did not actually write the preceding code. I actually wrote what follows, which looks much more Lisp-like, and ran it through a preprocessor that did symbol and string substitutions.

(((arg . ())
(quote . ())
(let . (()))
(cdr . (()()))
(if . (()()()))
(car . ((())))
(cons . ((())()))
(eval . (((()))))
(concat . ((())(()))))
.
(let ((concat
. (if (car . arg)
(if (car car . arg)
(cons (concat cons (car car . arg) . (cdr . arg))
. (cdr car . arg))
. (if (cdr car . arg)
(cons (quote . ())
. (concat cons (cdr car . arg) . (cdr . arg)))
. (cdr . arg)))
. (cdr . arg)))
("digit" .
(if arg
(if (car . arg)
(if (car car . arg)
(if (car car car . arg)
(if (car car car car . arg)
(if (car car car car car . arg)
(if (car car car car car car . arg)
(if (car car car car car car car . arg)
(if (car car car car car car car car . arg)
(quote . "9")
. (quote . "8"))
. (quote . "7"))
. (quote . "6"))
. (quote . "5"))
. (quote . "4"))
. (quote . "3"))
. (quote . "2"))
. (quote . "1"))
. (quote . "0")))
("count" .
(if (car . arg)
(concat cons ("digit" car . arg) . ("digit" cdr . arg))
. (if (cdr . arg)
("digit" cdr . arg)
. (quote . "no more"))))
("Count" .
(if (car . arg)
(concat cons ("digit" car . arg) . ("digit" cdr . arg))
. (if (cdr . arg)
("digit" cdr . arg)
. (quote . "No more"))))
("s" .
(if (car . arg)
(quote . "s")
. (if (cdr . arg)
(if (car cdr . arg)
(quote . "s")
. (quote . ""))
. (quote . "s"))))
("bottles" .
(concat cons ("count" . arg) .
(concat cons (quote . " bottle") .
(concat cons ("s" . arg) . (quote . " of beer")))))
("Bottles" .
(concat cons ("Count" . arg) .
(concat cons (quote . " bottle") .
(concat cons ("s" . arg) . (quote . " of beer")))))
("dec" .
(if (cdr . arg)
(cons (car . arg) . (car cdr . arg))
. (cons (car car . arg) . (quote . (((((((((())))))))))))))
("v1" .
(concat cons ("Bottles" . arg)
concat cons (quote . " on the wall, ")
concat cons ("bottles" . arg) .
(if (car . arg)
("v2" "dec" . arg)
. (if (cdr . arg)
("v2" "dec" . arg)
. (quote . ".
Go to the store and buy some more, 99 bottles of beer on the wall.
")))))
("v2" .
(concat cons (quote . ".
Take one down and pass it around, ")
concat cons ("bottles" . arg)
. (quote . " on the wall.

")))
("v" .
(concat cons ("v1" . arg)
. (if (car . arg)
("v" "dec" . arg)
. (if (cdr . arg)
("v" "dec" . arg)
. (quote . ()))))))
. ("v" quote . ((((((((((()))))))))) . (((((((((())))))))))))))

No comments:

Post a Comment