use buttifool `loop` function instead of ugly macro

master
cynic 3 years ago
parent 4e4075117b
commit 6ceb57bf7d
  1. 14
      lib/loop.klambda
  2. 6
      test.klambda

@ -1,8 +1,6 @@
DEFINE:loop:(def loop (lambda (counter max)\ (def loop (lambda (max i statement)
(all\ (all
statement\ statement
(cond (= counter max)\ (cond (= i max)
counter\ false
(loop (+ counter 1) max)))))\ (loop max (- i 1) (id statement))))))
(loop start end)\
:start:end:statement

@ -15,9 +15,11 @@ INCLUDE:./lib/aids.klambda
"adult (hag)" "adult (hag)"
"not adult (uoh)")) "not adult (uoh)"))
loop:0:100:(spit (cond (% counter 15) (cond (% counter 5) (cond (% counter 3) counter "fizz") "buzz") "fizzbuzz")) (loop 0 100
(id spit (cond (% i 15) (cond (% i 5) (cond (% i 3) i "fizz") "buzz") "fizzbuzz")))
(def moeblob ("moe" "moe~" "kyun!!")) (def moeblob ("moe" "moe~" "kyun!!"))
loop:0:(- (length moeblob) 1):(spit (at counter moeblob)) (loop 0 (- (length moeblob) 1)
(id spit (at i moeblob)))
(thesis) (thesis)
Loading…
Cancel
Save