Also, the "macros" documentation article makes it hard to understand because it looks outdated. Here's what I think is wrong: - The article says "member?" uses define-transform, but grepping for define-transform doesn't show anything for "member?". - The article says : "Macros can be used to give static stack effects to combinators that otherwise would not have static stack effects." Is this a vestigial remnant from the bad old days when static stack effects were optional, or can combinators still not have a stack effect? - In the "MACRO:" article, it says ".The word calling the macro has a static stack effect . The expansion quotation produced by the macro has a static stack effect" Again, words without static stack effect ?
Jon On Tue, Aug 17, 2010 at 7:20 PM, 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 > ? > > The context was that I wanted to have a word that randomly execute > quotations, for example > { > { 0.2 [ do-something ] } > { 0.1 [ something-else ] } > [ foo ] > } pcase > would execute the first quot with 0.2 probability, the second with 0.1 > probability and the third as a default (so 0.7 probability) > > 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... > > 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. > > What do you think ? > Jon > ------------------------------------------------------------------------------ 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
