blob: f8b9d4e292c3faa305d4255f1093f166839226d2 (
plain) (
tree)
|
|
# https://pbat.ch/wiki/giblang/
(def cons (array
"b" "c" "d" "f"
"g" "h" "j" "k"
"l" "m" "n" "p"
"r" "s" "t" "v"
"w" "z" "ch" "sh"
"zh" "th"))
(def vow (array "a" "e" "i" "o" "u" "y" "ee" "ai" "ae"))
(defn rpick (t)
(t (math/floor (* (math/random) (length t)))))
(defn seed () (math/seedrandom (os/time)))
(defn syl () (string (rpick cons) (rpick vow)))
(defn word ()
(do
(var str "")
(for i 0 (+ (math/floor (* (math/random) 3)) 1)
(set str (string str (syl))))
(cond (> (math/random) 0.2)
(set str (string str (rpick cons))))
(string str)))
(defn speak [number-of-words]
(seed)
(var words "")
(var i 0)
(while (< i number-of-words)
(set words (string words (word) " "))
(++ i))
(print words))
(speak 7)
|