Re: [Factor-talk] sequences and the stack

2011-08-25 Thread Andrew Pennebaker
Aha! How could I rewrite for-all? so that it prints the first stack that
fails the predicate?

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Thu, Aug 25, 2011 at 1:11 AM, Joe Groff arc...@gmail.com wrote:


 On Aug 24, 2011, at 10:05 PM, Andrew Pennebaker wrote:

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


 In your main you missed the [ ] around prop-even. This line:

 https://github.com/mcandre/factcheck/blob/master/example.factor#L12

 should read:

 [ prop-even ] [ gen-even ] for-all? .

 -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


Re: [Factor-talk] sequences and the stack

2011-08-25 Thread Joe Groff

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 outputsequence, then feed the array to the predicate via 
inputsequence:

:: for-all ( generator: ( -- ..a ) predicate: ( ..a -- ? ) -- ? )
1000 iota [ drop 
generator { } outputsequence : generated
generated predicate inputsequence : 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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Relative vocab roots

2011-08-25 Thread Joe Groff
Here's a patch to have the vocab loader save Factor's initial current directory 
at startup time and use it as the base for relative vocab roots such as .. 
That way, the program changing the current directory as part of its normal 
operation won't affect the vocab loader.

https://github.com/jckarter/factor/commit/dc619acbfc4ba4b6f2c6d0ff93f909ff718881b5

Is this a good approach? Will this break anything?

-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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Relative vocab roots

2011-08-25 Thread Slava Pestov
Hi Joe,

This looks good. I assume you tested it :-) My only objection is the
name vocab-base-directory. Is there a better name for this?

On Thu, Aug 25, 2011 at 3:04 PM, Joe Groff arc...@gmail.com wrote:
 Here's a patch to have the vocab loader save Factor's initial current 
 directory at startup time and use it as the base for relative vocab roots 
 such as .. That way, the program changing the current directory as part of 
 its normal operation won't affect the vocab loader.

 https://github.com/jckarter/factor/commit/dc619acbfc4ba4b6f2c6d0ff93f909ff718881b5

 Is this a good approach? Will this break anything?

 -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


Re: [Factor-talk] Relative vocab roots

2011-08-25 Thread Joe Groff

On Aug 25, 2011, at 7:26 PM, Slava Pestov wrote:

 Hi Joe,
 
 This looks good. I assume you tested it :-) My only objection is the
 name vocab-base-directory. Is there a better name for this?

I'm not crazy about the name either, but I couldn't think of anything better. 
My other choice was initial-current-directory, but I wasn't sure if that 
adequately described the variable's purpose.

-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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Relative vocab roots

2011-08-25 Thread Slava Pestov
On Thu, Aug 25, 2011 at 7:46 PM, Joe Groff arc...@gmail.com wrote:
 This looks good. I assume you tested it :-) My only objection is the
 name vocab-base-directory. Is there a better name for this?

 I'm not crazy about the name either, but I couldn't think of anything better. 
 My other choice was initial-current-directory, but I wasn't sure if that 
 adequately described the variable's purpose.

What about relative-vocab-root?

Slava

--
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