If Arc wants to get briefer I should think symbol macros would be a great addition. This is great example of variable capture as well: Background: In my CL code base I have extended the object model to support slots that work like cells in a spreadsheet. I will be releasing a lite version of that for Arc tonight. I have found it useful editing-wise to consistently refer to the primary object (in Arc's case table) as "self", liking Smalltalk and loathing C++. But I digress. Now I happen also to use a base Family class to great good effect all over the map, so I am always coding up (parent self) and (kids self) and even (car (kids self)) and (grand-parent self). //EOB With symbol macros I can: (define-symbol-macro .gramps
(parent (parent self))
And then: (def count-cousins (self)
(1- (loop for uncle in (kids .gramps)
summing (length (kids uncle)))))
Which reminds me, maybe Brevity the Prime Directive will make Mr. Graham reconsider CL's LOOP (perhaps calling it ITERATE since LOOP is taken). |