Skip to content

Commit

Permalink
e/Filter and e/When (experimental)
Browse files Browse the repository at this point in the history
  • Loading branch information
dustingetz committed Sep 13, 2024
1 parent 2987396 commit 3f2902a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hyperfiddle/electric3.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ this tuple. Returns the concatenation of all body results as a single vector.
(e/as-vec (do ~@body)))))))

(hyperfiddle.electric3/defn Count [xs] (-> xs pure i/count input))
(hyperfiddle.electric3/defn Filter [p? xs] (for [x xs] (if (p? x) x (amb)))) ; todo write as product
(defmacro When [test & body] `(if ~test (do ~@body) (amb)))

;; mklocal = declare lexical slot
;; bindlocal = bind lexical slot to value by name
Expand Down

0 comments on commit 3f2902a

Please sign in to comment.