Re: [Factor-talk] Relative vocab roots
On Thu, Aug 25, 2011 at 7:46 PM, Joe Groff 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
Re: [Factor-talk] Relative vocab roots
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
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 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
[Factor-talk] Relative vocab roots
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] sequences and the stack
On Aug 25, 2011, at 11:23 AM, Andrew Pennebaker wrote: > factcheck fully functional > https://github.com/mcandre/factcheck > > How should I package it so that others can install it? > > How does one install a Factor package? The Factor community's pretty tiny, so we just throw everything under extra/ in the main Factor repository. Set up your module as follows: - implementation in extra/factcheck/factcheck.factor - write unit tests and put them in extra/factcheck/factcheck-tests.factor - (optional but recommended) write docs and put them in extra/factcheck/factcheck-docs.factor - put your name in extra/factcheck/authors.txt - put some newline-separated tags in extra/factcheck/tags.txt > How does one load the code from a Factor package (is USE/USING enough)? Once the module is properly set up under extra, USING: factcheck ; will be sufficient. -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] sequences and the stack
One thing you can do is put your factcheck.factor into a "factcheck" directory in your project. Then, to install, someone can just checkout your code and add the project directory to vocab-roots, by either: 1) In the listener: ( scratchpad ) "/path/to/factcheck" add-vocab-root 2) Add it to the .factor-roots file to always be available: $ cat "/path/to/factcheck" >> ~/.factor-roots On Thu, Aug 25, 2011 at 11:23 AM, Andrew Pennebaker < andrew.penneba...@gmail.com> wrote: > factcheck fully functional > https://github.com/mcandre/factcheck > > How should I package it so that others can install it? > > How does one install a Factor package? > > How does one load the code from a Factor package (is USE/USING enough)? > > Cheers, > > Andrew Pennebaker > www.yellosoft.us > > On Thu, Aug 25, 2011 at 10:52 AM, Joe Groff wrote: > >> >> 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> >> :: for-all ( generator: ( -- ..a ) predicate: ( ..a -- ? ) -- ? ) >> 1000 iota [ drop >> generator { } output>sequence :> generated >> generated predicate input ok? >> ok? [ generated . ] unless >> ok? not >> ] find drop not ; inline >> >> -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 > > -- 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
factcheck fully functional https://github.com/mcandre/factcheck How should I package it so that others can install it? How does one install a Factor package? How does one load the code from a Factor package (is USE/USING enough)? Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 25, 2011 at 10:52 AM, Joe Groff wrote: > > 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 > :: for-all ( generator: ( -- ..a ) predicate: ( ..a -- ? ) -- ? ) > 1000 iota [ drop > generator { } output>sequence :> generated > generated predicate input ok? > ok? [ generated . ] unless > ok? not > ] find drop not ; inline > > -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
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 inputsequence :> generated generated predicate input 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
Re: [Factor-talk] sequences and the stack
if you want to keep the "quot { gen1 gen2 ... }" style of declaration, you can use and modify the following macro: USING: combinators.smart fry kernel macros math sequences namespaces ; IN: forall : gen-integer ( -- seq ) { 42 } ; : gen-even ( -- seq ) { 44 } ; : gen-odd ( -- seq ) { 43 } ; MACRO: for-all ( quot seq -- quot ) swap '[ [ execute _ all? ] curry ] map '[ _ 0&& ] ; : foo ( -- f ) [ even? ] { gen-integer gen-odd } for-all ; : bar ( -- t ) [ even? ] { gen-integer gen-even } for-all ; you could also save the generator if it fails in a variable in the for-all macro for later user (eg printing) Jon On Thu, Aug 25, 2011 at 9:34 AM, Andrew Pennebaker wrote: > 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 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 > > -- 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
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 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