Last active
August 29, 2015 14:01
-
-
Save hsjunnesson/0b3c20d7d9d2de45959e to your computer and use it in GitHub Desktop.
Revisions
-
hsjunnesson revised this gist
May 27, 2014 . 1 changed file with 26 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,28 +6,28 @@ A notation for diagramming signals. A line signifies time. ``` ──────────────────────────> ``` "Marbles" on the line corresponds to "next" events from the signal. ``` ───O───────O───────O──────> ``` A line at the end of the line corresponds to the "completed" event. ``` ───────────O─| ``` An X at the end of the line corresponds to the "error" event. ``` ─────────────X ``` @@ -40,22 +40,21 @@ A UISlider sends its own instance whenever the user moves the slider. ``` slider slider slider ───O───────O───────O───────> ``` We compose a new signal which derives from the original signal and maps each next event to the value of the slider at that point. ``` slider slider slider ───O───────O───────O───────> | | | +──────────────────────+ | map: slider -> value | +──────────────────────+ | 0.3 | 0.4 | 0.88 ───O───────O───────O───────> ``` The new signal, when subscribed to, will send the slider's value as floats. @@ -64,48 +63,43 @@ We can further compose the signal - to make it round to the nearest integer, plu ``` slider slider slider ───O───────O───────O───────> | | | +──────────────────────+ | map: slider -> value | +──────────────────────+ | 0.3 | 0.4 | 0.88 ───O───────O───────O───────> | | | +───────────────────────+ | map: round(value) + 1 | +───────────────────────+ | 1 | 1 | 2 ───O───────O───────O───────> ``` The next step is to make sure the slider only sends whenever there's a change in value. ``` slider slider slider ───O───────O───────O───────> | | | +──────────────────────+ | map: slider -> value | +──────────────────────+ | 0.3 | 0.4 | 0.88 ───O───────O───────O───────> | | | +───────────────────────+ | map: round(value) + 1 | +───────────────────────+ | 1 | 1 | 2 ───O───────O───────O───────> | | | +──────────────────────+ | distinctUntilChanged | +──────────────────────+ | 1 | 2 ───O───────────────O───────> ``` -
hsjunnesson renamed this gist
May 27, 2014 . 1 changed file with 0 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,36 +6,28 @@ A notation for diagramming signals. A line signifies time. ``` --------------------------> ``` "Marbles" on the line corresponds to "next" events from the signal. ``` ---O-------O-------O------> ``` A line at the end of the line corresponds to the "completed" event. ``` -----------O-| ``` An X at the end of the line corresponds to the "error" event. ``` -------------X ``` @@ -49,7 +41,6 @@ A UISlider sends its own instance whenever the user moves the slider. ``` slider slider slider ---O-------O-------O------> ``` We compose a new signal which derives from the original signal and @@ -65,7 +56,6 @@ maps each next event to the value of the slider at that point. +----------------------+ | 0.3 | 0.4 | 0.88 ---O-------O-------O------> ``` The new signal, when subscribed to, will send the slider's value as floats. @@ -89,7 +79,6 @@ We can further compose the signal - to make it round to the nearest integer, plu +-----------------------+ | 1 | 1 | 2 ---O-------O-------O------> ``` The next step is to make sure the slider only sends whenever there's a change in value. @@ -118,6 +107,5 @@ The next step is to make sure the slider only sends whenever there's a change in +----------------------+ | 1 | 2 ---O---------------O------> ``` -
hsjunnesson created this gist
May 27, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,123 @@ Marble diagrams =============== A notation for diagramming signals. A line signifies time. ``` --------------------------> ``` "Marbles" on the line corresponds to "next" events from the signal. ``` ---O-------O-------O------> ``` A line at the end of the line corresponds to the "completed" event. ``` -----------O-| ``` An X at the end of the line corresponds to the "error" event. ``` -------------X ``` Signal composition ------------------ We illustrate signal composition by the following notation. A UISlider sends its own instance whenever the user moves the slider. ``` slider slider slider ---O-------O-------O------> ``` We compose a new signal which derives from the original signal and maps each next event to the value of the slider at that point. ``` slider slider slider ---O-------O-------O------> | | | V V V +----------------------+ | map: slider -> value | +----------------------+ | 0.3 | 0.4 | 0.88 ---O-------O-------O------> ``` The new signal, when subscribed to, will send the slider's value as floats. We can further compose the signal - to make it round to the nearest integer, plus one. ``` slider slider slider ---O-------O-------O------> | | | V V V +----------------------+ | map: slider -> value | +----------------------+ | 0.3 | 0.4 | 0.88 ---O-------O-------O------> | | | V V V +-----------------------+ | map: round(value) + 1 | +-----------------------+ | 1 | 1 | 2 ---O-------O-------O------> ``` The next step is to make sure the slider only sends whenever there's a change in value. ``` slider slider slider ---O-------O-------O------> | | | V V V +----------------------+ | map: slider -> value | +----------------------+ | 0.3 | 0.4 | 0.88 ---O-------O-------O------> | | | V V V +-----------------------+ | map: round(value) + 1 | +-----------------------+ | 1 | 1 | 2 ---O-------O-------O------> | | | V V V +----------------------+ | distinctUntilChanged | +----------------------+ | 1 | 2 ---O---------------O------> ```