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-04-25 18:57:28 +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
|
|
|
|
|
|
|
|
&c fetch-next putn nl
|
|
|
|
fetch-next putn nl
|
|
|
|
fetch putn nl
|
2018-04-25 18:57:28 +02:00
|
|
|
~~~
|
2017-10-16 18:09:39 +02:00
|
|
|
|