File tree Expand file tree Collapse file tree 6 files changed +60
-108
lines changed Expand file tree Collapse file tree 6 files changed +60
-108
lines changed Original file line number Diff line number Diff line change 1
1
# ## Clerk ###
2
+ .clerk /
2
3
.cache /
3
4
4
5
# Created by https://www.toptal.com/developers/gitignore/api/vim,clojure
Original file line number Diff line number Diff line change 1
1
# Hassle
2
2
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.
6
6
7
7
``` clojure
8
8
#_procedural-imperative
@@ -14,5 +14,10 @@ of events.
14
14
(->> (input :init )
15
15
(node (map #(str " Hello World" )))
16
16
(output :stdout )
17
- net))
17
+ ( net 'main) ))
18
18
```
19
+
20
+ ## Usage
21
+
22
+ Refer to ` docs/xf-nets.clj ` for an introduction to the various functions
23
+ and supporting concepts.
Original file line number Diff line number Diff line change
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
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- ; ; # Building the `net` transducer
1
+ ; ; # Review of `net` transducers
2
2
; ; It's transducers all the way down and so we can learn about the `net`
3
3
; ; transducer by showing the more primitive transducers it uses.
4
4
11
11
(require '[net.n01se.hassle.core
12
12
:refer [net input node output]]))
13
13
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 )
17
18
18
19
; ; ## built-in transducers
19
20
; ; Several of the most primitve transducers in the tree come standard with
81
82
; ; `multiplex` is a higher order transducer that applies each value to multiple
82
83
; ; transducers. The results of all transducers are returned in a sequence.
83
84
; ; `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.
86
87
(sequence (multiplex [(take 2 ) (map -)]) (range 1 5 ))
87
88
(sequence (multiplex [(tag' :a ) (tag' :b )]) (range 2 ))
88
89
(sequence (multiplex [(detag' :a ) (detag' :b )]) [[:b " j" ] [:b " w" ] [:a 1 ]])
Original file line number Diff line number Diff line change 40
40
arr/as-svg
41
41
clerk/html))
42
42
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
+
43
69
(clerk/serve! {:browse? true })
44
70
(clerk/serve! {:watch-paths [" docs" " src" ]})
45
71
(clerk/show! " docs/xf-nets.clj" )
You can’t perform that action at this time.
0 commit comments