diff --git a/lib/loop.klambda b/lib/loop.klambda index 8df308d..f870e65 100644 --- a/lib/loop.klambda +++ b/lib/loop.klambda @@ -1,8 +1,8 @@ -DEFINE:loop:(defun loop\ +DEFINE:loop:(def loop (lambda (counter max)\ (all\ statement\ - (cond (= $1 $2)\ - $1\ - (loop (+ $1 1) $2))))\ + (cond (= counter max)\ + counter\ + (loop (+ counter 1) max)))))\ (loop start end)\ :start:end:statement diff --git a/test.klambda b/test.klambda index d1bd6d0..0cab6a5 100644 --- a/test.klambda +++ b/test.klambda @@ -15,9 +15,9 @@ INCLUDE:./lib/aids.klambda "adult (hag)" "not adult (uoh)")) -loop:0:100:(spit (cond (% $1 15) (cond (% $1 5) (cond (% $1 3) $1 "fizz") "buzz") "fizzbuzz")) +loop:0:100:(spit (cond (% counter 15) (cond (% counter 5) (cond (% counter 3) counter "fizz") "buzz") "fizzbuzz")) (def moeblob ("moe" "moe~" "kyun!!")) -loop:0:(length moeblob):(spit (at $1 moeblob)) +loop:0:(- (length moeblob) 1):(spit (at counter moeblob)) (thesis) \ No newline at end of file