propagators.nv
· 3.3 KiB · Text
Originalformat
Playground
||:@include: lib/rpn.nv
||:: a = b + c
||:: d = a + # 1
||:: b = 1
||:: c = 2
|:: $x = $y $op $z|
:: create some cells :names: ($x $y $z)
:: create an operator
:operation: $op
:inputs: $y $z
:output: $x
|:: $x = # $y $op $z|
:: $x = $y $op $z
:: set $y to $y
|:: $x = $y $op # $z|
:: $x = $y $op $z
:: set $z to $z
|:: $x = # $y $op # $z|
:: $x = $y $op $z
:: set $y to $y
:: set $z to $z
|:: $x = $y|
:: change $x to $y
|:: create a cell named $cell|
:: create some cells :names: $cell
|:: create some cells? :value: $cell $value|
|:: create some cells? :value: $cell |
|:: create some cells? :no such cell: $cell |
:cells: $cell
|:: create some cells? :names: $cell|
:: fetch the value of $cell
|:: create some cells|
|:: fetch the value of $cell :cells: $cell $value?|
:value: $cell $value
:: reset cells
|:: fetch the value of $cell :cells: $cell?|
:value: $cell
:: reset cells
|:: fetch the value of $cell? :cells: $ $value|
:checked cells: $ $value
|:: fetch the value of $cell? :cells: $|
:checked cells: $
|:: fetch the value of $cell|
:no such cell: $cell
:: reset cells
|:: reset cells? :checked cells: $cell $value|
:cells: $cell $value
|:: reset cells? :checked cells: $cell|
:cells: $cell
|:: reset cells|
|:: create an operator
:operation: $operation
:inputs: $first $second
:output: $output
|:operators: $operation $first $second $output
|:: change $cell to $value|
:: set $cell to $value
:: propagate $cell
|:: set $cell to $value :cells: $cell $|
:cells: $cell $value
:: reset cells
|:: set $cell to $value :cells: $cell|
:cells: $cell $value
:: reset cells
|:: set $cell to $value? :cells: $x $y|
:checked cells: $x $y
|:: set $cell to $value? :cells: $|
:checked cells: $
|:: set $cell to $value|
:: create a cell named $cell
:: change $cell to $value
|:: propagate $cell|
:: search for an operator that takes $cell as an input
:: unpack that operator
:: perform the operation
|:: search for an operator that takes $cell as an input
:operators: $op $cell $second $output?
|
|:: search for an operator that takes $cell as an input
:operators: $op $first $cell $output?
|
|:: search for an operator that takes $cell as an input?
:operators: $op $first $second $output
|:checked operators: $op $first $second $output
|:: search for an operator that takes $cell as an input|
:no operator found:
:: reset operators
|:: reset operators? :checked operators: $op $first $second $output|
:operators: $op $first $second $output
|:: reset operators|
|:: unpack that operator :no operator found:|
|:: unpack that operator :operators: $op $first $second $output?|
:operation: $op
:output: $output
:: fetch the value of $first
:: fetch the value of $second
:: reset operators
|:: perform the operation :@rpn data: $value :output: $cell|
:: change $cell to $value
|:: perform the operation?
:operation: $op
:value: $c1 $v1
:value: $c2 $v2
|:@rpn: ($v2 $v1 $op)
|:: perform the operation
:operation: $op
:value: $c1 $
:value: $c2
:output: $o
|
|:: perform the operation
:operation: $op
:value: $c1
:value: $c2 $
:output: $out
|
|:: perform the operation|
| 1 | ||:@include: lib/rpn.nv |
| 2 | |
| 3 | ||:: a = b + c |
| 4 | ||:: d = a + # 1 |
| 5 | ||:: b = 1 |
| 6 | ||:: c = 2 |
| 7 | |
| 8 | |:: $x = $y $op $z| |
| 9 | :: create some cells :names: ($x $y $z) |
| 10 | :: create an operator |
| 11 | :operation: $op |
| 12 | :inputs: $y $z |
| 13 | :output: $x |
| 14 | |
| 15 | |:: $x = # $y $op $z| |
| 16 | :: $x = $y $op $z |
| 17 | :: set $y to $y |
| 18 | |
| 19 | |:: $x = $y $op # $z| |
| 20 | :: $x = $y $op $z |
| 21 | :: set $z to $z |
| 22 | |
| 23 | |:: $x = # $y $op # $z| |
| 24 | :: $x = $y $op $z |
| 25 | :: set $y to $y |
| 26 | :: set $z to $z |
| 27 | |
| 28 | |:: $x = $y| |
| 29 | :: change $x to $y |
| 30 | |
| 31 | |:: create a cell named $cell| |
| 32 | :: create some cells :names: $cell |
| 33 | |:: create some cells? :value: $cell $value| |
| 34 | |:: create some cells? :value: $cell | |
| 35 | |:: create some cells? :no such cell: $cell | |
| 36 | :cells: $cell |
| 37 | |:: create some cells? :names: $cell| |
| 38 | :: fetch the value of $cell |
| 39 | |:: create some cells| |
| 40 | |
| 41 | |:: fetch the value of $cell :cells: $cell $value?| |
| 42 | :value: $cell $value |
| 43 | :: reset cells |
| 44 | |:: fetch the value of $cell :cells: $cell?| |
| 45 | :value: $cell |
| 46 | :: reset cells |
| 47 | |:: fetch the value of $cell? :cells: $ $value| |
| 48 | :checked cells: $ $value |
| 49 | |:: fetch the value of $cell? :cells: $| |
| 50 | :checked cells: $ |
| 51 | |:: fetch the value of $cell| |
| 52 | :no such cell: $cell |
| 53 | :: reset cells |
| 54 | |
| 55 | |:: reset cells? :checked cells: $cell $value| |
| 56 | :cells: $cell $value |
| 57 | |:: reset cells? :checked cells: $cell| |
| 58 | :cells: $cell |
| 59 | |:: reset cells| |
| 60 | |
| 61 | |:: create an operator |
| 62 | :operation: $operation |
| 63 | :inputs: $first $second |
| 64 | :output: $output |
| 65 | |:operators: $operation $first $second $output |
| 66 | |
| 67 | |:: change $cell to $value| |
| 68 | :: set $cell to $value |
| 69 | :: propagate $cell |
| 70 | |
| 71 | |:: set $cell to $value :cells: $cell $| |
| 72 | :cells: $cell $value |
| 73 | :: reset cells |
| 74 | |:: set $cell to $value :cells: $cell| |
| 75 | :cells: $cell $value |
| 76 | :: reset cells |
| 77 | |:: set $cell to $value? :cells: $x $y| |
| 78 | :checked cells: $x $y |
| 79 | |:: set $cell to $value? :cells: $| |
| 80 | :checked cells: $ |
| 81 | |:: set $cell to $value| |
| 82 | :: create a cell named $cell |
| 83 | :: change $cell to $value |
| 84 | |
| 85 | |:: propagate $cell| |
| 86 | :: search for an operator that takes $cell as an input |
| 87 | :: unpack that operator |
| 88 | :: perform the operation |
| 89 | |
| 90 | |:: search for an operator that takes $cell as an input |
| 91 | :operators: $op $cell $second $output? |
| 92 | | |
| 93 | |
| 94 | |:: search for an operator that takes $cell as an input |
| 95 | :operators: $op $first $cell $output? |
| 96 | | |
| 97 | |
| 98 | |:: search for an operator that takes $cell as an input? |
| 99 | :operators: $op $first $second $output |
| 100 | |:checked operators: $op $first $second $output |
| 101 | |
| 102 | |:: search for an operator that takes $cell as an input| |
| 103 | :no operator found: |
| 104 | :: reset operators |
| 105 | |
| 106 | |:: reset operators? :checked operators: $op $first $second $output| |
| 107 | :operators: $op $first $second $output |
| 108 | |:: reset operators| |
| 109 | |
| 110 | |:: unpack that operator :no operator found:| |
| 111 | |:: unpack that operator :operators: $op $first $second $output?| |
| 112 | :operation: $op |
| 113 | :output: $output |
| 114 | :: fetch the value of $first |
| 115 | :: fetch the value of $second |
| 116 | :: reset operators |
| 117 | |
| 118 | |:: perform the operation :@rpn data: $value :output: $cell| |
| 119 | :: change $cell to $value |
| 120 | |:: perform the operation? |
| 121 | :operation: $op |
| 122 | :value: $c1 $v1 |
| 123 | :value: $c2 $v2 |
| 124 | |:@rpn: ($v2 $v1 $op) |
| 125 | |:: perform the operation |
| 126 | :operation: $op |
| 127 | :value: $c1 $ |
| 128 | :value: $c2 |
| 129 | :output: $o |
| 130 | | |
| 131 | |:: perform the operation |
| 132 | :operation: $op |
| 133 | :value: $c1 |
| 134 | :value: $c2 $ |
| 135 | :output: $out |
| 136 | | |
| 137 | |:: perform the operation| |