On Fri, Oct 23, 2009 at 4:22 AM, Martial Boniou <[email protected]> wrote: > I am a newbie in Factor but I think it should be: > > PREDICATE: underweight-pig < pig weight>> 300 < ;
Correct. Predicates require a superclass. > but as 'my 2 cents' idea, it could be nice to be able to write the first. > We may have something like: > PREDICATE: special-something ... ; > without inheritance symbol < in this case. The reason predicates have to be guarded by a superclass is to speed up dispatch. If you have PREDICATE: even < integer 2 mod 0 = ; GENERIC: blah ( x -- y ) M: string blah reverse ; M: even blah 1 + ; Then calling blah on a string does not require the predicate even? to be tested. Slava ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
