Hello Slava,
thank you very much for your valuable hint!
Now my expression is
==
: sliceIndices ( seqLen sliceLen -- indices )
2dup swap [a,b] >r - [0,b] r> [ 2array ] 2map ;
==
; and it works like a charm!
Stephan
On 22.02.2008 23:09, Slava Pestov wrote:
> 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
>
--
Stephan Rudlof ([EMAIL PROTECTED])
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
-------------------------------------------------------------------------
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