fuck that I go to sleep

This commit is contained in:
didier amyot committed 2017-03-26 23:03:48 -04:00
1 parent ab85e9d430
commit 6f99ba137e
6 files changed
+144 -5

No files matched your search

+17 -4
View File
@@ -1,19 +1,32 @@
(ns transducerpres.presentation
(:require [transducerpres.slides.intro :refer [intro-slide]]
(:require [transducerpres.slides.util :refer [defmarkdownslide]]
[transducerpres.slides.intro :refer [intro-slide]]
[transducerpres.slides.roadmap :refer [roadmap-slide]]
[transducerpres.slides.what :refer [what-is-a-tranducer]]
[transducerpres.slides.how :refer [how-to-create-slides]]
[transducerpres.slides.revisiting-map :refer [revisiting-map-slides]]
[transducerpres.slides.analogy :refer [rich-hickey-analogy]]
[transducerpres.slides.transducer-function :refer [transducer-function-slides]]
[transducerpres.slides.stopping :refer [stopping-slides]]
[transducerpres.slides.state :refer [state-slides]]
[transducerpres.slides.arities :refer [arities-slides]]
[transducerpres.slides.completion :refer [completion-slides]]
))
(defmarkdownslide questions
"questions?")
(def presentation
[
intro-slide
[intro-slide
roadmap-slide
what-is-a-tranducer
rich-hickey-analogy
how-to-create-slides
revisiting-map-slides
transducer-function-slides])
transducer-function-slides
stopping-slides
state-slides
arities-slides
completion-slides
questions
])
+32
View File
@@ -0,0 +1,32 @@
(ns transducerpres.slides.arities
(:require [transducerpres.slides.util :refer [defslide defmarkdownslide markdown-part clj-code img]]))
(defmarkdownslide intro-slide
"#### The transducer function **must** support two more arities")
(defmarkdownslide one-arity
"#### completion of process"
"When a process terminates, the arity one transducer function"
"is called to allow transducer to do extra things")
(defmarkdownslide zero-arity
"#### initial reducing value"
"To allow initial values, trasducer **must** have an arity"
"zero function that calls the step function without any argument")
(defslide real-world-example
(markdown-part "real world example")
(clj-code
"(defn map [f]"
" (fn [rf]"
" (fn"
" ([] (rf))"
" ([result] (rf result))"
" ([result input]"
" (rf result (f input))))))"))
(defslide arities-slides
intro-slide
one-arity
zero-arity
real-world-example)
@@ -0,0 +1,21 @@
(ns transducerpres.slides.completion
(:require [transducerpres.slides.util :refer [defslide defmarkdownslide markdown-part clj-code img]]))
(defmarkdownslide intro-slide
"#### Completion can do thing at the very end")
(defmarkdownslide explanation
"#### Arity one moment"
"* The completion of the process is done at arity one"
"* It **must** finish by calling the step function with the result (arity one)")
(defmarkdownslide going-to-sleep
"#### Going to sleep..."
"https://github.com/clojure/clojure/blob/clojure-1.9.0-alpha14/src/clj/clojure/core.clj#L7115")
(defslide completion-slides
intro-slide
explanation
going-to-sleep)
+25
View File
@@ -0,0 +1,25 @@
(ns transducerpres.slides.state
(:require [transducerpres.slides.util :refer [defslide defmarkdownslide markdown-part clj-code img]]))
(defmarkdownslide intro-slide
"#### Creating transducers that has state")
(defslide thousand-words-example
(markdown-part "#### thousand words example")
(clj-code
"(defn take [n]"
" (fn [step]"
" (let [nv (volatile! n)]"
" (fn [result input]"
" (let [n @nv"
" nn (vswap! nv dec)"
" result (if (pos? n) (step result input) result)]"
" (if (not (pos? nn))"
" (reduced result)"
" result))))))"
))
(defslide state-slides
intro-slide
thousand-words-example)
@@ -0,0 +1,48 @@
(ns transducerpres.slides.stopping
(:require [transducerpres.slides.util :refer [defslide defmarkdownslide markdown-part clj-code img]]))
(defmarkdownslide intro-slide
"#### Stopping transducing process")
(defmarkdownslide goal
"#### goal"
"* transducers must be capable of calling 'completion'"
"* step functions must be capable of calling 'completion'")
(defmarkdownslide stopping-in-reduce
"#### `reduce` already support stopping the process"
"* `(reduced 3)` wraps 3 in a Reduced wrapper"
"* `(reduced? x)` tells is a value is wrapped"
"* `(deref x)` or `@x` will get you the wrapped value")
(defmarkdownslide reduced-transducer
"#### transducer **must** support the reduced \"interface\""
"* step functions can return reduced value"
"* if a transducer get a reduced value from a nested step,"
" it must never call that step function again with input")
(defmarkdownslide stopping-process
"#### reducing process **must** the rules too"
"* if a step function returns a reduced value it"
" the processs must not supply anymore input"
" to the step function"
"* the dereference value is the final accumulated value")
(defslide take-while-example
(markdown-part "#### take-while example")
(clj-code
"(defn take-while [pred]"
" (fn [step]"
" (fn [res x]"
" (if (pred x)"
" (step res x)"
" (reduced res)))))"))
(defslide stopping-slides
intro-slide
goal
stopping-in-reduce
stopping-process
take-while-example
)
@@ -1,5 +1,5 @@
(ns transducerpres.slides.transducer-function
(:require [transducerpres.slides.util :refer [defslide defmarkdownslide markdown-part clj-code python-code img]]))
(:require [transducerpres.slides.util :refer [defslide defmarkdownslide markdown-part clj-code img]]))
(defslide intro-slide