(test (+ 1 2 3)) (define $sample (lambda [$xs] (nth (pure-rand 1 (length xs)) xs))) (sample {1 2 3 4 5 6 7 8 9 10}) (define $fib-fast (match-lambda integer {[,0 0] [(& ?(lt? $ 0) $n) (if (even? n) (neg(fib-fast (neg n))) (fib-fast (neg n)))] [$n (letrec {[$fib-fast-iter (lambda [$a $b $p $q $c] (if (lt? c 2) (+ (* a p) (* b q)) (let {[$a' (if (odd? c) (+ (* a p) (* b q)) a)] [$b' (if (odd? c) (+ (* a q) (* b q) (* b p)) b)] [$p' (+ (* p p) (* q q))] [$q' (* (+ (* 2 p) q) q)] [$c' (quotient c 2)]} (fib-fast-iter a' b' p' q' c'))))]} (fib-fast-iter 0 1 0 1 n))]})) (test (map fib-fast (between -10 10))) (fib-fast 100) (define $sample #f);;再定義 (sample {1 2 3 4 5 6 7 8 9 10})