added man-or-boy test
This commit is contained in:
parent
44beaffea6
commit
b746240d77
|
@ -481,7 +481,22 @@ EOF
|
|||
|
||||
|
||||
|
||||
|
||||
;; Knuth's Man-or-boy-test.
|
||||
;; http://rosettacode.org/wiki/Man_or_boy_test
|
||||
(test '(begin (define (A k x1 x2 x3 x4 x5)
|
||||
(letrec ([B (lambda ()
|
||||
(set! k (- k 1))
|
||||
(A k B x1 x2 x3 x4))])
|
||||
(if (<= k 0)
|
||||
(+ (x4) (x5))
|
||||
(B))))
|
||||
(displayln (A 10
|
||||
(lambda () 1)
|
||||
(lambda () -1)
|
||||
(lambda () -1)
|
||||
(lambda () 1)
|
||||
(lambda () 0))))
|
||||
"-67\n")
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user