On Aug 25, 2011, at 12:34 AM, Andrew Pennebaker wrote: > Aha! How could I rewrite for-all? so that it prints the first stack that > fails the predicate?
The most straightforward thing I can think of is to package up the generated
values with output>sequence, then feed the array to the predicate via
input<sequence:
:: for-all ( generator: ( -- ..a ) predicate: ( ..a -- ? ) -- ? )
1000 iota [ drop
generator { } output>sequence :> generated
generated predicate input<sequence :> ok?
ok? [ generated . ] unless
ok? not
] find drop not ; inline
-Joe
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
