Anarchy Golf

http://d.hatena.ne.jp/knight_5/20100103を見てやってみようと思った。

1

(print "hello world")

2

(copy-port (current-input-port) (current-output-port))

3

(define (f x y)
  (let1 b (if (= x 1) "" "es")
  (print #`",x shinichiro,b of hamaji on the wall, ,x shinichiro,b of hamaji.")
  (cond ((= x 1) (print #`"Go to the store and buy some more, ,y shinichiroes of hamaji on the wall."))
	(else (print #`"Take one down and pass it around, ,(- x 1) shinichiro,(if (= x 2) \"\"b) of hamaji on the wall.\n")
	      (f (- x 1) y)))))
(f 99 99)

4

(use rfc.http)
(let1 m (#/:\/\/([^\/]+)/ (read-line))
  (display (values-ref (http-get (m 1) (m 'after)) 2)))

5

(define (f n)
  (let1 xs '(")") 
    (set-cdr! xs xs)
    (let/cc r (fold (lambda (x c) (display x) (if (= c 0) (r 0) (- c 1))) n `(: - ,@xs)))))
(dotimes (i 64) (f i) (newline))

6

(define f
  (let1 v #(#f 0 0)
    (lambda (i)
      (inc! (ref v i ))
      (let ((l (ref v 1)) (r (ref v 2)))
	(cond ((= (ref v i) 7) (print #`"Player,i wins the set ,l - ,r") #f)
	      ((= l r) (print "Set is tied at " r))
	      (else (print #`"Player,i leads ,l - ,r")))))))
(while (f (read)))

7

(use util.combinations)
(permutations-for-each (lambda (x) (print (apply string x))) 
		       (string->list (read-line)))