2017-10-16 18:09:39 +02:00
|
|
|
This is an example adding two three element vectors.
|
|
|
|
|
2018-04-25 18:57:28 +02:00
|
|
|
~~~
|
2017-10-16 18:09:39 +02:00
|
|
|
:vadd (v1v2v3-)
|
|
|
|
'abc 'cabcabcab reorder
|
|
|
|
[ #2 + ] tri@ [ fetch ] bi@ + swap store
|
|
|
|
[ n:inc ] tri@ [ fetch ] bi@ + swap store
|
|
|
|
[ fetch ] bi@ + swap store ;
|
2018-04-25 18:57:28 +02:00
|
|
|
~~~
|
2017-10-16 18:09:39 +02:00
|
|
|
|
|
|
|
A test case:
|
|
|
|
|
2018-06-20 15:03:22 +02:00
|
|
|
```
|
2017-10-16 18:09:39 +02:00
|
|
|
'a d:create #1 , #2 , #3 ,
|
|
|
|
'b d:create #2 , #3 , #4 ,
|
|
|
|
'c d:create #3 allot
|
|
|
|
|
|
|
|
&a &b &c vadd
|
|
|
|
|
2018-05-07 18:36:37 +02:00
|
|
|
&c fetch-next n:put nl
|
|
|
|
fetch-next n:put nl
|
|
|
|
fetch n:put nl
|
2018-06-20 15:03:22 +02:00
|
|
|
```
|
2017-10-16 18:09:39 +02:00
|
|
|
|