Try the 'find' combinator.
{ 1 3 4 5 } [ odd? not ] find
10 [ 8 = ] find
\ find help
Doug
On Mar 11, 2008, at 9:52 AM, Nikhil Marathe wrote:
> What I essentially want to do, in an imperative language would be
> ----------------------
>
> for ( i = 0 to length of seq )
> if( !function( seq[i] ) )
> break;
> -----------------------
>
> But for some reason, I'm having a lot of trouble juggling the stack in
> Factor, to achieve this.
> function is a quotation which takes an elt and returns ?
> But putting an integer (initially 0) to access the array elements,
> and then
> using recursion, is driving me up the wall.
> I don't think each-integer does exactly what I want, nor does unfold.
>
> How efficient is 'clone' at copying really big vectors? Should I
> clone the
> sequence and then just keep popping elements?
>
> There is definitely an easy solution, but I think I'm missing some
> crucial
> property, and writing really big words, so if you guys could help
> me...
>
> Thanks a lot,
> Nikhil
> ----------------------------------------------------------------------
> ---
> 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
-------------------------------------------------------------------------
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