9 Aug 2006 15:44
Re: Collection utility
Lars Brinkhoff <lars <at> nocrew.org>
2006-08-09 13:44:04 GMT
2006-08-09 13:44:04 GMT
"Thomas F. Burdick" <tfb <at> OCF.Berkeley.EDU> writes: > In 2001, I spent a little too much time thinking about the optimal > interface to a collection utility, as evidenced by this thread on > comp.lang.lisp: > http://groups.google.com/groups?threadm=xcvsnbgix4v.fsf%40famine.OCF.Berkeley.EDU > > I'd thought I posted the collection utility I wrote as a result, > but I can't find it anywhere. So, three years later, here it is. Two years later, triggered by rereading Thomas' post, and feeling a need to implementing my own ideas about the optimal collection utility, I came up with these two macros: "WITH-COLLECTOR (&KEY NAME TYPE &ALLOW-OTHER-KEYS) FORM* => RESULT NAME -- a symbol naming the collector; not evaluated. The default is NIL. TYPE -- the type of the collection; evalutated. The default is 'LIST. FORMS -- an implicit progn. RESULT -- the resulting collection. In the body, (COLLECT <object> :INTO <name>) is defined to collect an object into the corresponding named collection. The default for NAME is NIL, which is also the default for INTO. If NAME is not NIL, a variable by that name is bound to the result, and may be referenced anywhere within the body. Additional keyword arguments are passed to the collector for type TYPE." "WITH-COLLECTORS ((NAME &KEY TYPE &ALLOW-OTHER-KEYS)*) FORM* => RESULT* NAME -- a symbol naming the collector; not evaluated.(Continue reading)
RSS Feed