whalesong/tests/more-tests/simple-apply.rkt
2011-07-28 14:46:32 -04:00

17 lines
261 B
Racket

#lang planet dyoo/whalesong
(apply + 2 3 4 5 '())
(apply (lambda args args) 2 3 4 5 '())
"now factorial"
(define (f x)
(cond
[(apply = `(,x 0))
1]
[else
(apply * `(,x ,(apply f (apply sub1 (apply list x '())) '())))]))
(f 3)
(+ (f 4) (f 5))