Skip to content

Commit

Permalink
[lang] r/ap prep for holding file/line metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurC committed Sep 19, 2024
1 parent 693bc48 commit 1319583
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion src/hyperfiddle/electric/impl/lang3.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@
(let [nd (get (:eav ts) e)]
(case (::type nd)
::literal (::v nd)
::ap (list* `r/ap (mapv rec (get-children-e ts e)))
::ap (list* `r/ap {} (mapv rec (get-children-e ts e)))
::var (let [in (::resolved-in nd)]
(list* `r/lookup 'frame (keyword (::qualified-var nd))
(when (or (nil? in) (= in (->env-type env))) [(list `r/pure (::qualified-var nd))])))
Expand Down
10 changes: 5 additions & 5 deletions src/hyperfiddle/electric/impl/runtime3.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ T T T -> (EXPR T)
(try (apply invoke args)
(catch #?(:clj Throwable :cljs :default) e (#?(:clj prn :cljs js/console.error) e))))

(deftype Ap [inputs
(deftype Ap [mt inputs
^:unsynchronized-mutable ^:mutable hash-memo]
#?(:clj Object)
#?(:cljs IHash)
Expand All @@ -184,8 +184,8 @@ T T T -> (EXPR T)
(EXPR (A -> T)) (EXPR A) -> (EXPR T)
(EXPR (A B -> T)) (EXPR A) (EXPR B) -> (EXPR T)
(EXPR (A B C -> T)) (EXPR A) (EXPR B) (EXPR C) -> (EXPR T)
" [& inputs]
(->Ap inputs nil))
" [mt & inputs]
(->Ap mt inputs nil))

(deftype Join [input ^:unsynchronized-mutable ^:mutable hash-memo]
#?(:clj Object)
Expand Down Expand Up @@ -305,7 +305,7 @@ T T T -> (EXPR T)
(apply bind-args (bind-self ctor) args)
(let [[fixed map? ctor] (get-variadic nm F arity)]
(bind (apply bind-args (bind-self ctor) (take fixed args))
fixed (apply ap (pure (varargs map?)) (drop fixed args)))))))
fixed (apply ap {} (pure (varargs map?)) (drop fixed args)))))))

(defn peer-defs [^objects peer]
(aget peer peer-slot-defs))
Expand Down Expand Up @@ -1096,7 +1096,7 @@ T T T -> (EXPR T)
(->Join input nil)))
"ap" (t/read-handler
(fn [inputs]
(->Ap inputs nil)))
(->Ap {} inputs nil)))
"pure" (t/read-handler
(fn [[value]]
(->Pure value nil)))
Expand Down
Loading

0 comments on commit 1319583

Please sign in to comment.