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)\
(all\
statement\
(cond (= counter max)\
counter\
(loop (+ counter 1) max)))))\
(loop start end)\
:start:end:statement
(def loop (lambda (max i statement)
(all
statement
(cond (= i max)
false
(loop max (- i 1) (id statement))))))

@ -15,9 +15,11 @@ INCLUDE:./lib/aids.klambda
"adult (hag)"
"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!!"))
loop:0:(- (length moeblob) 1):(spit (at counter moeblob))
(loop 0 (- (length moeblob) 1)
(id spit (at i moeblob)))
(thesis)
Loading…
Cancel
Save