propagators.nv
· 2.0 KiB · Text
Eredeti
Playground
|| :@include: lib/rpn.nv
|| :: declare variables :: (a b c d)
:: c = b * a
:: d = c + a
:: a <- 3
:: b <- 2
|:: $x <- $y|
:: set $x to $y
:: propagate variable $x
|:: declare variables? :: $name| :: var $name
|:: declare variables|
|:: var $x :default value: $y?| :: $x = $y
|:: var $x| :: $x = 0
|:: $x = $y| :: set $x to $y
|:: $z = $x $op $y|
:nodes: $op $x $y $z
|:: set $x to $y :variables: $x $z|
:: reset variables
:variables: $x $y
|:: set $x to $y :not found: $x|
:: reset variables
:variables: $x $y
|:: set $x to $y?|
:: find $x
|:: fetch the value of $x :variables: $x $y?|
:: reset variables
:values: $y
|:: fetch the value of $x :not found: $x?|
|:: fetch the value of $x?|
:: find $x
|:: propagate variable $x|
:: fetch nodes that depend on $x
:: propagate changes
:: prime the network
|:: propagate changes :dependencies: $op $x $y $z|
:: fetch the value of $y
:: fetch the value of $x
:: compute $op and store it in $z
:: propagate variable $z
:visited: $op $x $y $z
|:: propagate changes|
|:: compute $op and store it in $z :@rpn data: $x|
:: set $z to $x
|:: compute $op and store it in $z? :values: ($x $y)|
:@rpn: ($x $y $op)
|:: fetch nodes that depend on $x? :nodes: $op $x $y $z|
:dependencies: $op $x $y $z
|:: fetch nodes that depend on $x? :nodes: $op $y $x $z|
:dependencies: $op $y $x $z
|:: fetch nodes that depend on $x? :nodes: $op $w $y $z|
:checked nodes: $op $w $y $z
|:: fetch nodes that depend on $x|
:: reset nodes
|:: find $x :variables: $x $y?|
|:: find $x? :variables: $z $y|
:checked variables: $z $y
|:: find $x|
:: reset variables
:not found: $x
|:: reset variables? :checked variables: $x $y|
:variables: $x $y
|:: reset variables|
|:: reset nodes? :checked nodes: $op $x $y $z|
:nodes: $op $x $y $z
|:: reset nodes|
|:: prime the network? :visited: $op $x $y $z|
:nodes: $op $x $y $z
|:: prime the network|
| 1 | || :@include: lib/rpn.nv |
| 2 | |
| 3 | || :: declare variables :: (a b c d) |
| 4 | :: c = b * a |
| 5 | :: d = c + a |
| 6 | :: a <- 3 |
| 7 | :: b <- 2 |
| 8 | |
| 9 | |:: $x <- $y| |
| 10 | :: set $x to $y |
| 11 | :: propagate variable $x |
| 12 | |
| 13 | |:: declare variables? :: $name| :: var $name |
| 14 | |:: declare variables| |
| 15 | |
| 16 | |:: var $x :default value: $y?| :: $x = $y |
| 17 | |:: var $x| :: $x = 0 |
| 18 | |
| 19 | |:: $x = $y| :: set $x to $y |
| 20 | |:: $z = $x $op $y| |
| 21 | :nodes: $op $x $y $z |
| 22 | |
| 23 | |:: set $x to $y :variables: $x $z| |
| 24 | :: reset variables |
| 25 | :variables: $x $y |
| 26 | |:: set $x to $y :not found: $x| |
| 27 | :: reset variables |
| 28 | :variables: $x $y |
| 29 | |:: set $x to $y?| |
| 30 | :: find $x |
| 31 | |
| 32 | |:: fetch the value of $x :variables: $x $y?| |
| 33 | :: reset variables |
| 34 | :values: $y |
| 35 | |:: fetch the value of $x :not found: $x?| |
| 36 | |:: fetch the value of $x?| |
| 37 | :: find $x |
| 38 | |
| 39 | |:: propagate variable $x| |
| 40 | :: fetch nodes that depend on $x |
| 41 | :: propagate changes |
| 42 | :: prime the network |
| 43 | |
| 44 | |:: propagate changes :dependencies: $op $x $y $z| |
| 45 | :: fetch the value of $y |
| 46 | :: fetch the value of $x |
| 47 | :: compute $op and store it in $z |
| 48 | :: propagate variable $z |
| 49 | :visited: $op $x $y $z |
| 50 | |:: propagate changes| |
| 51 | |
| 52 | |:: compute $op and store it in $z :@rpn data: $x| |
| 53 | :: set $z to $x |
| 54 | |:: compute $op and store it in $z? :values: ($x $y)| |
| 55 | :@rpn: ($x $y $op) |
| 56 | |
| 57 | |:: fetch nodes that depend on $x? :nodes: $op $x $y $z| |
| 58 | :dependencies: $op $x $y $z |
| 59 | |:: fetch nodes that depend on $x? :nodes: $op $y $x $z| |
| 60 | :dependencies: $op $y $x $z |
| 61 | |:: fetch nodes that depend on $x? :nodes: $op $w $y $z| |
| 62 | :checked nodes: $op $w $y $z |
| 63 | |:: fetch nodes that depend on $x| |
| 64 | :: reset nodes |
| 65 | |
| 66 | |:: find $x :variables: $x $y?| |
| 67 | |:: find $x? :variables: $z $y| |
| 68 | :checked variables: $z $y |
| 69 | |:: find $x| |
| 70 | :: reset variables |
| 71 | :not found: $x |
| 72 | |
| 73 | |:: reset variables? :checked variables: $x $y| |
| 74 | :variables: $x $y |
| 75 | |:: reset variables| |
| 76 | |
| 77 | |:: reset nodes? :checked nodes: $op $x $y $z| |
| 78 | :nodes: $op $x $y $z |
| 79 | |:: reset nodes| |
| 80 | |
| 81 | |:: prime the network? :visited: $op $x $y $z| |
| 82 | :nodes: $op $x $y $z |
| 83 | |:: prime the network| |
| 84 |