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 could dispatch on the class names themselves, and use Factor's predicate classes and class algebra to naturally describe more specific constraints: EQ-GENERIC: arbitrary ( class -- value ) ! not in factor, unfortunately M: integer arbitrary 2 64 ^ random ; PREDICATE: even-integer < integer even? ; M: even-integer arbitrary 2 63 ^ random 2 * ; \ integer arbitrary . ! would print e.g. 12345 \ even-integer arbitrary . ! would print e.g. 12346 INTERSECTION: even-fixnum fixnum even-integer ; M: even-fixnum arbitrary most-positive-fixnum 2 / random 2 * ; \ even-fixnum arbitrary . -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