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
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
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
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 predicat
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 } ;
MACR
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
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
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 exec
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 cou
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? vowel?
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. A
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
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.
Pe
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 “input macro input
smime.p7s
Description: S/MIME cryptographic signature
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
;
>>>> Cheers,
>>>>
>>>> Andrew Pennebaker
>>>> www.yellosoft.us
>>>>
>>>> On Sun, Aug 21, 2011 at 2:26 PM, Alexander J. Vondrak <
>>>> ajvond...@csupomona.edu> wrote:
>>>>
>>>>> first2: http:
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,...
ndrak <
>>> ajvond...@csupomona.edu> wrote:
>>>
>>>> first2: http://docs.factorcode.org/content/word-first2,sequences.html
>>>>
>>>> In general, firstn:
>>>> http://docs.factorcode.org/content/word-firstn,sequences.generalizations.html
>
factorcode.org/content/word-firstn,sequences.generalizations.html
>>>
>>> Regards,
>>> --Alex Vondrak
>>>
>>> From: Andrew Pennebaker [andrew.penneba...@gmail.com]
>>> Sent: Sunday, August 21, 2011 11:20 AM
>&
om: Andrew Pennebaker [andrew.penneba...@gmail.com]
>> Sent: Sunday, August 21, 2011 11:20 AM
>> To: Factor
>> Subject: [Factor-talk] sequences and the stack
>>
>> The stack contains a sequence of number pairs:
>>
>> { { x1 y1 } { x2 y2 } { x3 y3 } ... }
>>
nt: Sunday, August 21, 2011 11:20 AM
> To: Factor
> Subject: [Factor-talk] sequences and the stack
>
> The stack contains a sequence of number pairs:
>
> { { x1 y1 } { x2 y2 } { x3 y3 } ... }
>
> I want to map over the pairs, accessing xi and yi.
>
> [
> ! stack = { xi yi
eneralizations.html
>
> Regards,
> --Alex Vondrak
>
> From: Andrew Pennebaker [andrew.penneba...@gmail.com]
> Sent: Sunday, August 21, 2011 11:20 AM
> To: Factor
> Subject: [Factor-talk] sequences and the stack
>
> The stack
: Sunday, August 21, 2011 11:20 AM
To: Factor
Subject: [Factor-talk] sequences and the stack
The stack contains a sequence of number pairs:
{ { x1 y1 } { x2 y2 } { x3 y3 } ... }
I want to map over the pairs, accessing xi and yi.
[
! stack = { xi yi }
! ...
! stack = xi yi
] map
What
The stack contains a sequence of number pairs:
{ { x1 y1 } { x2 y2 } { x3 y3 } ... }
I want to map over the pairs, accessing xi and yi.
[
! stack = { xi yi }
! ...
! stack = xi yi
] map
What's the code that goes in !... ?
Other than using nth, how can I do this? Is there a word that
24 matches
Mail list logo