Tropical algebra overloading: Difference between revisions
Content added Content deleted
(Add Factor) |
m (→{{header|Factor}}: change names, tweak output) |
||
Line 35: | Line 35: | ||
<lang factor>USING: io kernel math math.order present prettyprint sequences ; |
<lang factor>USING: io kernel math math.order present prettyprint sequences ; |
||
ALIAS: |
ALIAS: ⊕ max |
||
ALIAS: |
ALIAS: ⊗ + |
||
ALIAS: |
ALIAS: ↑ * |
||
: show ( quot -- ) |
: show ( quot -- ) |
||
dup present rest but-last " |
dup present rest but-last "⟶ " append write call . ; inline |
||
{ |
{ |
||
[ 2 -2 |
[ 2 -2 ⊗ ] |
||
[ -0.001 -1/0. |
[ -0.001 -1/0. ⊕ ] |
||
[ 0 -1/0. |
[ 0 -1/0. ⊗ ] |
||
[ 1.5 -1 |
[ 1.5 -1 ⊕ ] |
||
[ -0.5 0 |
[ -0.5 0 ⊗ ] |
||
[ 5 7 |
[ 5 7 ↑ ] |
||
[ 8 7 |
[ 8 7 ⊕ 5 ⊗ ] |
||
[ 5 8 |
[ 5 8 ⊗ 5 7 ⊗ ⊕ ] |
||
[ 8 7 |
[ 8 7 ⊕ 5 ⊗ 5 8 ⊗ 5 7 ⊗ ⊕ = ] |
||
} [ show ] each</lang> |
} [ show ] each</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
2 -2 |
2 -2 ⊗ ⟶ 0 |
||
-0.001 -1/0. |
-0.001 -1/0. ⊕ ⟶ -0.001 |
||
0 -1/0. |
0 -1/0. ⊗ ⟶ -1/0. |
||
1.5 -1 |
1.5 -1 ⊕ ⟶ 1.5 |
||
-0.5 0 |
-0.5 0 ⊗ ⟶ -0.5 |
||
5 7 |
5 7 ↑ ⟶ 35 |
||
8 7 |
8 7 ⊕ 5 ⊗ ⟶ 13 |
||
5 8 |
5 8 ⊗ 5 7 ⊗ ⊕ ⟶ 13 |
||
8 7 |
8 7 ⊕ 5 ⊗ 5 8 ⊗ 5 7 ⊗ ⊕ = ⟶ t |
||
</pre> |
</pre> |
||