yamlscript 2024-06-24

Sadly, my "Introducing YAMLScript" talk proposal for Heart of Clojure was not accepted.

😠 1

Hoping to catch up with it at Conj!

Hope so 🤞

Added support for:

$ YS_FORMATTER=zprint ys -c 99-bottles.ys
(declare paragraph bottles)
(defn main
  ([number] (each [n (rng number 1)] (say (paragraph n))))
  ([] (main 99)))
(defn paragraph
  [num]
  (str (bottles num)
       " of Perl on the wall,\n" (bottles num)
       " of Perl.\nTake one down, slurp it around,\n" (bottles (- num 1))
       " of Perl on the wall." "\n"))
(defn bottles
  [n]
  (cond (== n 0) "No more bottles"
        (== n 1) "1 bottle"
        :else (str n " bottles")))
(apply main ARGS)

🎉 1

YS_FORMATTER can be set to any program (even with args)

$ YS_FORMATTER='zprint "{:width 500}"' ys -c 99-bottles
(declare paragraph bottles)
(defn main ([number] (each [n (rng number 1)] (say (paragraph n)))) ([] (main 99)))
(defn paragraph [num] (str (bottles num) " of Perl on the wall,\n" (bottles num) " of Perl.\nTake one down, slurp it around,\n" (bottles (- num 1)) " of Perl on the wall." "\n"))
(defn bottles
  [n]
  (cond (== n 0) "No more bottles"
        (== n 1) "1 bottle"
        :else (str n " bottles")))
(apply main ARGS)

zprint is much too big to compile into the binary.