re-implement `spit` and `input` in terms of `w` and `r`

master
cynic 3 years ago
parent bdd5ca60d7
commit de6cf59164
  1. 20
      lib/kokoro.klambda
  2. 6
      test.klambda

@ -1,11 +1,19 @@
INCLUDE:./loop.klambda
(def spit-raw (lambda (cunny)
(w "/dev/fd/1" cunny)))
(def spit (lambda (cunny) (def spit (lambda (cunny)
(miracle (spit-raw (+ (conv string cunny) "\n"))))
"__import__('builtins')" "print" (id cunny))))
(def prettyspit-lst (lambda (lst-cunny)
(each lst-cunny
(id spit-raw (+ (conv string item) " ")))))
(def input (lambda () (def input (lambda ()
(miracle (r "/dev/fd/0" 20)))
"__import__('builtins')" "input" (""))))
(def thesis (lambda () (def thesis (lambda ()
(spit (spit
("this language belongs to makise kurisu. there are many like it, but this one is hers.")))) "this language belongs to makise kurisu. there are many like it, but this one is hers.")))
DEFINE:<3:(thesis) (def <3 thesis)

@ -1,12 +1,12 @@
INCLUDE:./lib/aids.klambda INCLUDE:./lib/aids.klambda
(def a (id (id "desu"))) (def a (id (id "desu")))
(spit (prettyspit-lst
("lol swej" (+ 9000 1) a)) ("lol swej" (+ 9000 1) a))
(spit (cond (= "10" (+ 1 9)) "same" "not same")) (spit (cond (= "10" (+ 1 9)) "same" "not same"))
(cond ("", (+ 0 1)) (cond ("", (+ 0 1))
(id spit "one") (spit "one")
(id spit "zero")) (spit "zero"))
(spit "how old are you? > ") (spit "how old are you? > ")
(def age (conv number (input))) (def age (conv number (input)))

Loading…
Cancel
Save