I should also add something I alluded to in another discussion (under 'positions'); this is the idea of making \any parameter into a rest parameter. For instance, if you had
(defnsk add [addend augend] ...) you could call it like (add :addend 1 2 3 :augend 1 2) or (add [1 2 3] [1 2 3 4]). Must the poor programmer now check \all of his parameters to see if they have been magically turned into rest parameters without his knowing? Of course not! The function body is simply executed repeatedly, and the results put in a list: (add [1 2 3] [1 2 3 4]) -> [2 4 6] If we were being \really permissive, we might want to return \two results, one the straightforward element-by-element adding, the other the 'cartesian' adding: [[2 4 6],[[2 3 4 5][3 4 5 6][4 5 6 7]]]. Or we might allow a flag passed to all functions :cartesian :sequential to turn this behavior on or off. If function writers want to explicitly manipulate these sequences, of course, that is fine; all I am saying is that if they do nothing, the function \caller gets his sequence code for free. To assist this way of programming, it might be a good idea to have another type of 'permissive' sequence abstraction, which you might call for old time's sake car and cdr: (car [1 2 3]) -> 1 (cdr [1 2 3]) -> [2 3] (car 1) -> 1 (cdr 1) -> nil A direct reference to a sequence as if it were a singular element, meanwhile, is an invitation to deal with the sequence at the level of the function caller as we do above (who if he passes elements as a sequence, presumably knows what he is doing). I guess this is getting to be a pretty epic macro! I figured it was worth inviting boos and/or cheers and suggestions before setting out... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en