On Thu, Dec 4, 2008 at 9:31 PM, Eduardo Cavazos <[EMAIL PROTECTED]> wrote:
> range-model-label: http://paste.factorcode.org/paste?id=238
There's a clean way to do this without locals. I discovered this idiom
recently, it's not entirely obvious, so I thought I'd share it with
the list:
:: range-model-label ( text model -- gadget )
[ <shelf> ] 2dip
[ <label> add-gadget ]
[ [ first round number>string ] <filter> <label-control> add-gadget ] bi* ;
So we start with ( shelf obj1 obj2 ) on the stack, and then call bi*
with two quotations having effect ( shelf obj -- shelf ). The result
is just a shelf.
It also works equally well for setters,
[ >>foo ] [ >>bar ] bi*
This has effect ( obj new-foo new-bar -- obj ).
Slava
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk