22 Apr 09:20
Re: Named shufflers (rethought of "factor-way locals" idea)
From: Eduardo Cavazos <wayo.cavazos@...>
Subject: Re: Named shufflers (rethought of "factor-way locals" idea)
Newsgroups: gmane.comp.lang.factor.general
Date: 2008-04-22 07:20:24 GMT
Subject: Re: Named shufflers (rethought of "factor-way locals" idea)
Newsgroups: gmane.comp.lang.factor.general
Date: 2008-04-22 07:20:24 GMT
Maxim Savtchenko wrote: > Damn. It looks like I need git for all this beautiful bleeding-edge > features. If you have some more code which is more complicated than you'd like it to be, feel free to post it and we'll see if any new features can be used to simplify it. > Thank you for reply. Slot changers are juisy. Recently I wrote about unifying accessors on sequences, tables, and tuples. One part of that experiment is having a 'change' word which works across all of those: GENERIC: change ( collection key quot -- collection ) And some effect variants: GENERIC: change-at ( collection quot key -- collection ) GENERIC: changed-at ( collection quot key -- ) So the 'adjust-counter' would look like this: : adjust-counter ( dns-stream string -- string ) tuck length [ + ] curry :counter changed-at ; There is an implementation benefit from having a general 'change' as opposed to slot specific changers generated for each slot: the image size is reduced. Predicate words for tuples are another example of "generated" words. Something that may be on the horizon is doing away with those in favor of an 'is?' word. I.e. given this: TUPLE: planet name ; the word 'planet?' would not be auto-generated. Instead, you'd use 'is?': GENERIC: is? ( object class -- ? ) Ed ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
RSS Feed