Re: [Factor-talk] TryRuby, etc.

2011-08-24 Thread Andrew Pennebaker
Note that this handbook is not a tutorial... --Forward to the Factor Developer's Handbook It's still a valuable resource. Thanks. Cheers, Andrew Pennebaker www.yellosoft.us On Tue, Aug 23, 2011 at 11:15 PM, Michael Clagett mclag...@hotmail.comwrote: Hi Andrew -- Not a video tutorial,

Re: [Factor-talk] TryRuby, etc.

2011-08-24 Thread Slava Pestov
I can't load that link right now, but IIRC this is just the old Factor 0.72 docs in PDF format. On Wed, Aug 24, 2011 at 1:00 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Note that this handbook is not a tutorial... --Forward to the Factor Developer's Handbook It's still a valuable

Re: [Factor-talk] TryRuby, etc.

2011-08-24 Thread Andrew Pennebaker
http://factor.bluishcoder.co.nz/responder/fjsc is down :( Cheers, Andrew Pennebaker www.yellosoft.us On Tue, Aug 23, 2011 at 11:29 PM, Chris Double chris.dou...@double.co.nzwrote: On Wed, Aug 24, 2011 at 12:25 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Has anyone made an

Re: [Factor-talk] TryRuby, etc.

2011-08-24 Thread John Benediktsson
This Factor Playground provides some basics on how Factor works, although I believe its a clone in Javascript (so it isn't making calls into a true Factor process). http://personal.inet.fi/koti/egaga/jsfactor/playground.html On Wed, Aug 24, 2011 at 1:19 PM, Michael Clagett

[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

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

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

[Factor-talk] pull request

2011-08-24 Thread Jon Harper
jon@zephyr:~/factor$ git request-pull -p origin/master g...@github.com:jonenst/factor.git master The following changes since commit 45df73a0caebb4ff3b93c6f6d3bf9b2a78028ce7: fjsc: display the proper namespace when using set_in. (2011-08-24 15:20:51 -0700) are available in the git repository

Re: [Factor-talk] pull request

2011-08-24 Thread John Benediktsson
Thanks, merged. On Wed, Aug 24, 2011 at 3:48 PM, Jon Harper jon.harpe...@gmail.com wrote: jon@zephyr:~/factor$ git request-pull -p origin/master g...@github.com:jonenst/factor.git master The following changes since commit 45df73a0caebb4ff3b93c6f6d3bf9b2a78028ce7: fjsc: display the proper

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

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Andrew Pennebaker
Is there a word more general than firstn? I'd like to push all the elements of a sequence onto the stack. Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Aug 21, 2011 at 2:26 PM, Alexander J. Vondrak ajvond...@csupomona.edu wrote: first2:

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread John Benediktsson
Typically there are better ways to operate on sequences than to put all the elements on the stack, but you could: ( scratchpad ) { 0 1 2 3 } dup length firstn Better might be to use some combinators to act on the sequence each grabbing the element that they need (bi, tri, or the more general

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Andrew Pennebaker
I've got a function that I want to call over a sequence of values (both are determined at run time). Is there something like call that accepts a sequence of arguments? Something like this: f args call-seq Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 24, 2011 at 10:04 PM, John

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread John Benediktsson
Look at inputsequence from combinators.smart. On Wed, Aug 24, 2011 at 7:19 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: I've got a function that I want to call over a sequence of values (both are determined at run time). Is there something like call that accepts a sequence of

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Joe Groff
On Aug 24, 2011, at 6:50 PM, Andrew Pennebaker wrote: Is there a word more general than firstn? I'd like to push all the elements of a sequence onto the stack. Asking for a function that pushes all the elements of an arbitrary sequence onto the stack is like asking for an [a] - (a,a,a,...)

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Andrew Pennebaker
Thanks, inputsequence seems to be what I'm looking for. I must be incorrectly declaring and passing the quotations, because I get a compilation error. Code at GitHub https://github.com/mcandre/factcheck. $ ./example.factor Loading /Users/andrew/.factor-rc The word for-all cannot be executed

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Andrew Pennebaker
Aye, it's a bit awkward, but I know that Haskell can do it because that's how Haskell's QuickCheck library works. It even goes one step further and creates the appropriate list of value generators according to the predicate's type. Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 24, 2011

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Joe Groff
On Aug 24, 2011, at 8:38 PM, Andrew Pennebaker wrote: $ ./example.factor Loading /Users/andrew/.factor-rc The word for-all cannot be executed because it failed to compile Cannot apply “inputsequence” to an input parameter of a non-inline word macro inputsequence inputsequence is also a

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Joe Groff
On Aug 24, 2011, at 8:44 PM, Andrew Pennebaker wrote: Aye, it's a bit awkward, but I know that Haskell can do it because that's how Haskell's QuickCheck library works. It even goes one step further and creates the appropriate list of value generators according to the predicate's type.

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Andrew Pennebaker
My goal is to test a user-supplied predicate, e.g. even? with a function for-all that checks even? for all values (actually just 100 random values), in other words, that arbitrary-integer even? is always true. Obviously this is not true, but we need a predicate that fails in order to test the test

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Joe Groff
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.

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Andrew Pennebaker
The exemplar idea is attractive, especially since it's idiomatic in Factor. However, an exemplar of 1 may not be precise enough for certain predicates. How can we define sufficiently specific exemplars for predicates like non-negative? positive? divides-by-three? byte? char? lowercase char?

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Joe Groff
On Aug 24, 2011, at 9:50 PM, Andrew Pennebaker wrote: The exemplar idea is attractive, especially since it's idiomatic in Factor. However, an exemplar of 1 may not be precise enough for certain predicates. True. Unfortunately Factor doesn't support CLOS-style eq generics, otherwise you

Re: [Factor-talk] sequences and the stack

2011-08-24 Thread Andrew Pennebaker
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