Hi voosey,
I see that nobody has answered your question so far, so here some chatter from the ##lisp IRC channel on Freenode.net with funny Lisp code.
Everything started with the question "if woah is a misspelling of whoa, what is the meaning of woah?" Then I looked at urbandictionary.com and there was written "Woah, you have nothing better to do with your time than to look up the spelling of woah." Some other guy said: "Woah, that's a recursive definition of woah!" and that's why I wrote this recursive definition of woah:
Code: Select all
(defun woah ()
"Print some nonsense recursively a random number of times."
(princ "WOAH! ")
(if (zerop (random 10))
(finish-output)
(woah)))
(princ "WOAH! ") prints WOAH! and a space character without any line-break, then the function calls itself until (random 10) returns a zero. (finish-output) flushes the output buffer.
Here's what happens at the REPL:
Code: Select all
CL-USER> (woah)
WOAH! WOAH! WOAH! WOAH! WOAH! WOAH! WOAH! WOAH!
Then we saw that WOAH! looks like batman fight noise what lead to the following code:
Code: Select all
(defparameter *noise* '(awk bam bang biff blop boff bonk clank clash clunk
crash crunch kapow klonk klunk krunch pam plop pow slosh splat swap swish
swooch thunk twack ugh urk vronk whack wham whap zam zap zlonk zlop zlot
zok zow zwap)
"Weird batman fight noise.")
(defun batman (words)
"Make some batman fight noise of random words and length."
(let ((word (nth (random (length words)) words)))
(cond ((zerop (random 10))
(format t "~S!~%" word)
(finish-output))
(t
(format t "~S!, " word)
(batman (remove word words))))))
(nth (random (length words)) words) picks a random word from the list of words. (format t <format-string> <arguments>) prints the arguments as a string to the *standard-output* stream. (remove word words) removes the printed word from the list of words before the function is recursively called to avoid duplicate words on the screen.
Here you can watch batman fight at the REPL:
Code: Select all
CL-USER> (batman *noise*)
SWOOCH!, URK!, CRUNCH!, ZOK!, ZAP!, PLOP!, UGH!, PAM!
In the CLiki (Common Lisp Wiki) under
Getting Started there are lots of links to free books and other stuff.
- edgar