switch the loop macro to a named lambda as a quick fix

master
cynic 3 years ago
parent 69b7a2c6d1
commit 219bab5ed8
  1. 8
      lib/loop.klambda
  2. 4
      test.klambda

@ -1,8 +1,8 @@
DEFINE:loop:(defun loop\ DEFINE:loop:(def loop (lambda (counter max)\
(all\ (all\
statement\ statement\
(cond (= $1 $2)\ (cond (= counter max)\
$1\ counter\
(loop (+ $1 1) $2))))\ (loop (+ counter 1) max)))))\
(loop start end)\ (loop start end)\
:start:end:statement :start:end:statement

@ -15,9 +15,9 @@ INCLUDE:./lib/aids.klambda
"adult (hag)" "adult (hag)"
"not adult (uoh)")) "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!!")) (def moeblob ("moe" "moe~" "kyun!!"))
loop:0:(length moeblob):(spit (at $1 moeblob)) loop:0:(- (length moeblob) 1):(spit (at counter moeblob))
(thesis) (thesis)
Loading…
Cancel
Save