Joe, your for-all? looks promising (and it's incredibly short). However,
when I try it, I'm still getting that macro error.

Latest code incorporating your for-all?:

https://github.com/mcandre/factcheck

Macro Error:

$ ./example.factor
Loading /Users/andrew/.factor-rc
The word main cannot be executed because it failed to compile

Cannot apply “call” to a run-time computed value
macro call

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Thu, Aug 25, 2011 at 12:49 AM, Joe Groff <arc...@gmail.com> wrote:

>
> On Aug 24, 2011, at 9:30 PM, Andrew Pennebaker wrote:
>
> *predicate* { *gen-type1* *gen-type2* *gen-type3* ... } for-all
>
>
> The generators needn't be in an array; they could be a simple quotation.
> Simply calling each generator function in turn will line up their outputs on
> the stack in the proper order. Assuming the net output effect of the
> generators is supposed to match the input effect of the predicate, the
> generators and predicate together would have a constant effect ( -- ? ). The
> following works, and should be general enough for everything you describe:
>
> CONSTANT: number-of-tries 1,000
>
> : for-all? ( generator: ( -- ..a ) predicate: ( ..a -- ? ) -- ? )
>     [ number-of-tries iota ] 2dip '[ drop @ @ not ] find drop not ; inline
>
> ( scratchpad ) [ 2 64 ^ random ] [ even? ] for-all? .
> f
> ( scratchpad ) [ 2 64 ^ random 2 * ] [ even? ] for-all? .
> t
>
> : random-string ( -- x ) 32 random [ HEX: 10FFFF random ] "" replicate-as ;
>
> ( scratchpad ) [ random-string random-string ] [ [ [ length ] bi@ + ] [
> append length ] 2bi = ] for-all?
> t
>
> -Joe
>
>
> ------------------------------------------------------------------------------
> 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
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to