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)
(miracle
"__import__('builtins')" "print" (id cunny))))
(spit-raw (+ (conv string cunny) "\n"))))
(def prettyspit-lst (lambda (lst-cunny)
(each lst-cunny
(id spit-raw (+ (conv string item) " ")))))
(def input (lambda ()
(miracle
"__import__('builtins')" "input" (""))))
(r "/dev/fd/0" 20)))
(def thesis (lambda ()
(spit
("this language belongs to makise kurisu. there are many like it, but this one is hers."))))
DEFINE:<3:(thesis)
"this language belongs to makise kurisu. there are many like it, but this one is hers.")))
(def <3 thesis)

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

Loading…
Cancel
Save