Slava,

I think a version of ((copy)) which would be generally useful is:

  : ((copy)) ( dst i src j -- )
      swap nth-unsafe swap rot set-nth-unsafe ; inline

Copy element j in src to element i in dst.

It's also much simpler than the current ((copy)). Here's a version of (copy) 
which works with this ((copy)):

: (copy) ( dst i src j n -- dst )
  [ 4dup ((copy)) 1+ rot 1+ -rot ] times 3drop ; inline

This one is also in some ways simpler than the original (copy). It's not 
recursive. There's no test and if.

Now the 'n' is simply a counter. The indices into the src and dst are 
incremented each step through (1+ rot 1+ -rot).

These versions pass the sequences tests.

Ed

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to