On Tue, Aug 17, 2010 at 10:20 AM, Jon Harper <[email protected]> wrote: > Hi, > I looked at the implementation of cond and case, and I saw the > define-transform and "no-compile" word property. How is it different > from the MACRO: construction ? Is user code supposed to use it at all > ?
Not really. define-transform lets you have a different definition for the optimized and non-optimized usages of the word, so its only needed for combinators such as 'cond' which are called a lot during bootstrap. In this case you want to avoid generating the quotation every time, so the non-optimized definition is used. For user code which is always optimized, define-transform does not offer any benefits. > Both solutions use a pcase>quot word (like cond and case) and then one > uses MACRO: and the other uses define-transform. Both seem to work > fine... Use MACRO:. > Also, maybe this combinator (and others) could ship with factor in > extra/random/combinators ? I'm thinking of a variant where the > probabilities are conditionnal (ie in the previous example, the first > quotation would execute with 0.2 probability, then the second with > 0.1, which makes an overall (1-0.2)*0.1 probability, and so on..). > Also, variants of if, when and unless that take a probability instead > of taking a boolean. Sure, if you make a vocab with docs and tests then I'll pull it in. Slava ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
