Hi Stephan,

This is invalid:

... >r [ r> ... >r ] some-combinator r> ;

Combinators use >r/r> internally, and as you can see in the 
documentation you are only supposed to use >r/r> within a single quotation.

In your case it is better to use 2map instead of 2each, and you won't 
need to use ?push or V{ } clone or anything like that.

Also 0 swap [a,b] is already in the library, its called [0,b].

Slava

Stephan Rudlof wrote:
> ! this variant does not work: don't know, why
> : sliceIndicesn ( seqLen sliceLen -- indices )
>     f >r 2dup swap [a,b] >r - 0 swap [a,b] r> [ 2array r> ?push >r ]  2each 
> r> ;
>
> I don't understand, why the '>r', 'r>' mechanism in the second variant fails: 
> probably because "Concretely, a quotation is an immutable sequence of 
> objects,..." (from the docs).
> Is there a better alternative to the first variant?
>
>
> Regards,
> Stephan
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
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