~subsetpark/fugue

98b59f83dda1f5a3892295ef948eaa9c8bcadc37 — Zach Smith 8 days ago 8dd16a2
Defn new- form
1 files changed, 12 insertions(+), 1 deletions(-)

M fugue.janet
M fugue.janet => fugue.janet +12 -1
@@ 141,6 141,16 @@

(eval (pred*-form 'Root))

(defn- init-name [name] (symbol "new-" name))

(defn- new-form
  "Generate the init form wrapper."
  [name]
  (let [init-name (init-name name)]
    ~(defn ,init-name [& rest] (:new ,name ;rest))))

(eval (new-form 'Root))

(defn- getters
  [name fields]
  (let [forms @[]]


@@ 182,7 192,7 @@

  `parent-name` is required; it can be an existing prototype, *or*
  some null-ish value. If null-ish (`nil` or `()` should make the most
                                          sense...) the parent of the prototype will be set to `fugue/Root`.
  sense...) the parent of the prototype will be set to `fugue/Root`.

  `fields` should be 0 or more pairs of the following format:



@@ 265,6 275,7 @@
           (put :new ,(init-form name init-args))))
      (pred-form name)
      (pred*-form name)
      (new-form name)
      ;(getters name fields))))

(defn prototype?