Tuesday, March 13, 2012

Understanding What It's Like to Program in Forth

Understanding What It's Like to Program in Forth: ": vadd ( v1 v2 v2 -- )
>r
over 1st @ over 1st @ + r@ 1st !
over 2nd @ over 2nd @ + r@ 2nd !
over 3rd @ over 3rd @ + r@ 3rd !
rdrop drop drop ;
And that's it--three element vector addition in Forth."

'via Blog this'


ouch.