Skip to content

Commit 5d99438

Browse files
committed
Add docs
1 parent 9e3a196 commit 5d99438

File tree

6 files changed

+60
-108
lines changed

6 files changed

+60
-108
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
### Clerk ###
2+
.clerk/
23
.cache/
34

45
# Created by https://www.toptal.com/developers/gitignore/api/vim,clojure

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Hassle
22

3-
An experimental reactive functional library for Clojure. The primary goal is to
4-
demonstrate the ability to express programs as a DAG of functions over streams
5-
of events.
3+
An experimental reactive functional library for Clojure. The primary goal
4+
is to demonstrate the ability to express programs as a DAG of functions
5+
over streams of events.
66

77
```clojure
88
#_procedural-imperative
@@ -14,5 +14,10 @@ of events.
1414
(->> (input :init)
1515
(node (map #(str "Hello World")))
1616
(output :stdout)
17-
net))
17+
(net 'main)))
1818
```
19+
20+
## Usage
21+
22+
Refer to `docs/xf-nets.clj` for an introduction to the various functions
23+
and supporting concepts.

docs/meetup.clj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
;; # Transducer Nets
2+
;; *Southern NH Clojure Group*
3+
4+
;; *Wednesday, February 23, 2022*
5+
6+
;; ## Outline
7+
;; 1. Intro *(you are here)*
8+
;; 2. Walk through the API offered to define transducer nets
9+
;; 3. Review the various transducers used under the hood
10+
;; 4. Next Steps & Discussion
11+
12+
;; ## Intro
13+
;; * **What**: library that allows composition of transducers in Directed
14+
;; Acyclic Graph.
15+
;; * **Why**: Define Process Flow Networks with pure functions.
16+
;; * **Where**: https://github.com/jclaggett/hassle
17+
;; * **Status**: Experimental

docs/slides.md

Lines changed: 0 additions & 98 deletions
This file was deleted.

docs/transducers.clj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;; # Building the `net` transducer
1+
;; # Review of `net` transducers
22
;; It's transducers all the way down and so we can learn about the `net`
33
;; transducer by showing the more primitive transducers it uses.
44

@@ -11,9 +11,10 @@
1111
(require '[net.n01se.hassle.core
1212
:refer [net input node output]]))
1313

14-
;; ## Transducer Family Tree
15-
;; This diagram shows the 'familty tree' of transducers used by `net`:
16-
;; [TODO] make a tree diagram!
14+
;; ## Transducer Composition Tree
15+
;; This diagram shows the 'composition tree' of transducers used to define `net` (blue are
16+
;; transducers added):
17+
(render-xf-compose-tree)
1718

1819
;; ## built-in transducers
1920
;; Several of the most primitve transducers in the tree come standard with
@@ -81,8 +82,8 @@
8182
;; `multiplex` is a higher order transducer that applies each value to multiple
8283
;; transducers. The results of all transducers are returned in a sequence.
8384
;; `multiplex` is reduced when all transducers are reduced. This particular
84-
;; transducer is directly inspired by the `multiplex` found over at
85-
;; https://github.com/cgrand/xforms
85+
;; transducer is directly inspired by the `multiplex` transducer found over at
86+
;; https://github.com/cgrand/xforms.
8687
(sequence (multiplex [(take 2) (map -)]) (range 1 5))
8788
(sequence (multiplex [(tag' :a) (tag' :b)]) (range 2))
8889
(sequence (multiplex [(detag' :a) (detag' :b)]) [[:b "j"] [:b "w"] [:a 1]])

src/user.clj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,32 @@
4040
arr/as-svg
4141
clerk/html))
4242

43+
(defn render-xf-compose-tree []
44+
(-> (arr/create-graph)
45+
(arr/with-graph
46+
(let [v-map (arr/insert-vertex! "map")
47+
v-take-while (arr/insert-vertex! "take-while")
48+
v-filter (arr/insert-vertex! "filter")
49+
v-final (arr/insert-vertex! "final" :fill-color "lightblue")
50+
v-tag (arr/insert-vertex! "tag" :fill-color "lightblue")
51+
v-detag (arr/insert-vertex! "detag" :fill-color "lightblue")
52+
v-multiplex (arr/insert-vertex! "multiplex" :fill-color "lightblue")
53+
v-demultiplex (arr/insert-vertex! "demultiplex" :fill-color "lightblue")
54+
v-net (arr/insert-vertex! "net" :fill-color "lightblue")]
55+
(arr/insert-edge! v-tag v-net)
56+
(arr/insert-edge! v-detag v-net)
57+
(arr/insert-edge! v-multiplex v-net)
58+
(arr/insert-edge! v-demultiplex v-net)
59+
(arr/insert-edge! v-final v-tag)
60+
(arr/insert-edge! v-filter v-detag)
61+
(arr/insert-edge! v-take-while v-detag)
62+
(arr/insert-edge! v-map v-detag)))
63+
64+
arr/as-svg
65+
clerk/html))
66+
67+
68+
4369
(clerk/serve! {:browse? true})
4470
(clerk/serve! {:watch-paths ["docs" "src"]})
4571
(clerk/show! "docs/xf-nets.clj")

0 commit comments

Comments
 (0)