Skip to content

Commit

Permalink
diff-by docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
leonoel committed Jan 26, 2024
1 parent c277207 commit d49f979
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hyperfiddle/electric_de.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
(let [~@(interleave bs (eduction (map #(list ::lang/lookup %)) (range)))]
~@body)))

(defmacro diff-by [f xs] `(join (i/diff-by ~f (join (i/items (pure ~xs))))))
(defmacro diff-by "
Syntax :
```clojure
(diff-by kf xs)
```
Stabilizes successive states of collection `xs` with function `kf`. Returns each item as a table.
" [f xs] `(join (i/diff-by ~f (join (i/items (pure ~xs))))))

;; (defmacro drain [expr] `(join (i/drain (pure ~expr))))
(defmacro client [& body] `(::lang/site :client ~@body))
(defmacro server [& body] `(::lang/site :server ~@body))
Expand Down

0 comments on commit d49f979

Please sign in to comment.