~subsetpark/ec

9689f9aaa033e55a46beeceb1ab6fb2469ea5088 — Zach Smith 7 months ago 81ff55c
Some more help
2 files changed, 7 insertions(+), 3 deletions(-)

M main.janet
M src/compose.janet
M main.janet => main.janet +5 -2
@@ 34,10 34,13 @@
  (defn- describe
    [elem]
    (let [evaled (eval/eval s elem)]
      (printf "%s: %s\n\n%s"
      (printf "%s: %s\n\n%s%s"
              (print/p evaled)
              (string (evaled :type))
              (evaled :doc))))
              (evaled :doc)
              (if (evaled :composes)
                (string/format "\n\n(%s)" (print/p (evaled :composes)))
                ""))))
  (each item (q :data)
    (describe item))
  "")

M src/compose.janet => src/compose.janet +2 -1
@@ 8,6 8,7 @@
                    :arity ,arity
                    :type ,(keyword name)
                    :doc ,doc
                    :composes (array ,;words)
                    :fun-ref (fn ,name [stack]
                               ,;(seq [word :in words]
                                   ~(calc/push stack ,word))))))


@@ 38,7 39,7 @@

(defcompose dip 2
  ```
  S a q -- S q
  S a q -- S' a
  > saves [the second] element away, executes the quotation on whatever of the
  > stack is left, and then restores the saved element.