added more tests

This commit is contained in:
Danny Yoo 2012-02-21 16:21:11 -05:00
parent 5e411d0bf5
commit 3b6b634f75
4 changed files with 1141 additions and 0 deletions

View File

@ -0,0 +1 @@
(1000000 1000000)

View File

@ -0,0 +1,64 @@
#lang planet dyoo/whalesong/base
;; Imperative body:
(define (loops n)
(let ((result 0))
(let loop1 ((i1 1))
(if (> i1 n)
'done
(begin
(let loop2 ((i2 1))
(if (> i2 n)
'done
(begin
(let loop3 ((i3 1))
(if (> i3 n)
'done
(begin
(let loop4 ((i4 1))
(if (> i4 n)
'done
(begin
(let loop5 ((i5 1))
(if (> i5 n)
'done
(begin
(let loop6 ((i6 1))
(if (> i6 n)
'done
(begin
(set! result (+ result 1))
(loop6 (+ i6 1)))))
(loop5 (+ i5 1)))))
(loop4 (+ i4 1)))))
(loop3 (+ i3 1)))))
(loop2 (+ i2 1)))))
(loop1 (+ i1 1)))))
result))
;; Functional body:
(define (func-loops n)
(let loop1 ((i1 1)(result 0))
(if (> i1 n)
result
(let loop2 ((i2 1)(result result))
(if (> i2 n)
(loop1 (+ i1 1) result)
(let loop3 ((i3 1)(result result))
(if (> i3 n)
(loop2 (+ i2 1) result)
(let loop4 ((i4 1)(result result))
(if (> i4 n)
(loop3 (+ i3 1) result)
(let loop5 ((i5 1)(result result))
(if (> i5 n)
(loop4 (+ i4 1) result)
(let loop6 ((i6 1)(result result))
(if (> i6 n)
(loop5 (+ i5 1) result)
(loop6 (+ i6 1) (+ result 1)))))))))))))))
(let ((cnt 10))
(list
(loops cnt)
(func-loops cnt)))

View File

@ -0,0 +1 @@
("eight" "eleven" "five" "four" "nine" "one" "seven" "six" "ten" "three" "twelve" "two")

File diff suppressed because it is too large Load Diff