[Factor-talk] No word named “--” found in current vocabulary search path

2011-08-24 Thread Andrew Pennebaker
I'm porting the QuickCheck unit test framework to Factor. The idea is to
test properties (quotations) against test values.

For example, to test whether all integers have the property even:

[ even? ] { gen-integer } for-all

The property is a quotation because isn't evaluated directly but passed
values from gen-integer.

for-all will test properties with different types and numbers of arguments,
that's why gen-integer is inside a sequence.

So for-all's type hint should be something like

: for-all ( quot seq -- ? )
   ! ...
   ;

And gen-integer's type hint would be something like

: gen-integer ( -- quot | quot: -- n )
   ! ...
   ;

I'm getting an error, though. Factor doesn't like my type hint for
gen-integer.

$ ./example.factor
Loading /Users/andrew/.factor-rc
./example.factor

3: INCLUDING: factcheck ;
   ^
factcheck.factor

5: : gen-integer ( -- quot | quot: -- n ) [ random-32 ] ;
 ^
No word named “--” found in current vocabulary search path

In 
factcheck.factorhttps://github.com/mcandre/factcheck/blob/master/factcheck.factor
:

! A quotation generating a random integer.
: gen-integer ( -- quot | quot: -- n ) [ random-32 ] ;

In 
example.factorhttps://github.com/mcandre/factcheck/blob/master/example.factor
:

#! /usr/bin/env factor

INCLUDING: factcheck ;
USING: math prettyprint ;
IN: example

: main ( -- )
gen-integer apply .

Am I not using the pipe (|) correctly in the type hint?

Cheers,

Andrew Pennebaker
www.yellosoft.us
--
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] No word named “--” found in current vocabulary search path

2011-08-24 Thread Slava Pestov
Hi Andrew,

You're using the old convention (from handbook.pdf? :-) ) Please
review recent docs:

http://docs.factorcode.org/content/article-inference.html
http://docs.factorcode.org/content/article-effects.html

Slava

On Wed, Aug 24, 2011 at 3:02 PM, Andrew Pennebaker
andrew.penneba...@gmail.com wrote:
 I'm porting the QuickCheck unit test framework to Factor. The idea is to
 test properties (quotations) against test values.
 For example, to test whether all integers have the property even:
 [ even? ] { gen-integer } for-all
 The property is a quotation because isn't evaluated directly but passed
 values from gen-integer.
 for-all will test properties with different types and numbers of arguments,
 that's why gen-integer is inside a sequence.
 So for-all's type hint should be something like
 : for-all ( quot seq -- ? )
    ! ...
    ;
 And gen-integer's type hint would be something like
 : gen-integer ( -- quot | quot: -- n )
    ! ...
    ;
 I'm getting an error, though. Factor doesn't like my type hint for
 gen-integer.
 $ ./example.factor
 Loading /Users/andrew/.factor-rc
 ./example.factor
 3: INCLUDING: factcheck ;
                        ^
 factcheck.factor
 5: : gen-integer ( -- quot | quot: -- n ) [ random-32 ] ;
                                      ^
 No word named “--” found in current vocabulary search path
 In factcheck.factor:
 ! A quotation generating a random integer.
 : gen-integer ( -- quot | quot: -- n ) [ random-32 ] ;
 In example.factor:
 #! /usr/bin/env factor
 INCLUDING: factcheck ;
 USING: math prettyprint ;
 IN: example
 : main ( -- )
     gen-integer apply .
 Am I not using the pipe (|) correctly in the type hint?
 Cheers,
 Andrew Pennebaker
 www.yellosoft.us
 --
 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] No word named “--” found in current vocabulary search path

2011-08-24 Thread Joe Groff

On Aug 24, 2011, at 3:16 PM, Slava Pestov wrote:

 Hi Andrew,
 
 You're using the old convention (from handbook.pdf? :-) ) Please
 review recent docs:
 
 http://docs.factorcode.org/content/article-inference.html
 http://docs.factorcode.org/content/article-effects.html

Even I'm having trouble finding a straightforward answer to this in those docs. 
More to the point, the modern syntax for higher-order stack effects is ( name: 
( nested -- effect ) -- ). For example:

: foo ( a b quot: ( a b -- c d e ) -- c d e )
call ;
: bar ( a b quot1: ( a b -- c d e ) quot2: ( c d e -- f ) -- f )
[ call ] bi@ ;


-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] No word named “--” found in current vocabulary search path

2011-08-24 Thread Andrew Pennebaker
Thanks. I see the type hint syntax is close to Haskell's. Excellent!

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Wed, Aug 24, 2011 at 6:36 PM, Joe Groff arc...@gmail.com wrote:


 On Aug 24, 2011, at 3:16 PM, Slava Pestov wrote:

 Hi Andrew,

 You're using the old convention (from handbook.pdf? :-) ) Please
 review recent docs:

 http://docs.factorcode.org/content/article-inference.html
 http://docs.factorcode.org/content/article-effects.html


 Even I'm having trouble finding a straightforward answer to this in those
 docs. More to the point, the modern syntax for higher-order stack effects is
 ( name: ( nested -- effect ) -- ). For example:

 : foo ( a b quot: ( a b -- c d e ) -- c d e )
 call ;
 : bar ( a b quot1: ( a b -- c d e ) quot2: ( c d e -- f ) -- f )
  [ call ] bi@ ;


 -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