[Factor-talk] Beginner question about style and stack shuffling

2012-03-12 Thread nicolas.o...@gmail.com
Dear all, I am starting to learn Factor as my first concatenative language (from a FP background) and enjoy it very much. However, when trying to write simple words I get stuck on how to best express dataflow. As a (very very simple) example, I am trying to write a word : swap-element ( i1 arra

Re: [Factor-talk] Beginner question about style and stack shuffling

2012-03-12 Thread nicolas.o...@gmail.com
Thank you very much for both answers. They both are very instructive. This one is really amazing though: > > ``` > TUPLE: array-ref index array ; > C: array-ref > : >array-ref< ( array-ref -- index array ) >    [ index>> ] [ array>> ] bi ; > : get-ref ( array-ref -- elt ) >    >array-ref< nth ;