I can't imagine this idea will be met warmly, but I have a suggestion. It requires ending maps and vectors as functions of keys. Instead, make the first argument to a collection be a function which is mapped to across the collection. Any additional arguments are passed to the function on each invocation. For maps and hashes, this would only be applied to the values. Keys would remain the same.
Some examples: ('(1 2 3) * 2) => (2 4 6) ({:greet "hello" :farewell "goodbye"} str " Mark") => {:greet "hello Mark" :farewell "goodbye Mark"} If the primary type used as keys are keywords or symbols, we don't give up much. As (:key map) still works in place of (map :key). I'm not tied to this idea. I thought of it a while ago, and it certainly has its draw backs. I wouldn't suggest a 1/2 way solution -- making lists functions of functions and maps functions of keys -- thats certainly a world of headaches. Anyway, back to business as usual. Cheers, -Mark On Jan 11, 2009, at 9:59 PM, Chouser wrote: > > On Sun, Jan 11, 2009 at 9:38 PM, Ethan Herdrick <herdr...@gmail.com> > wrote: >> >> Why aren't all sequences callable, i.e. why don't they all implement >> IFn? I'd like to use lists like this sometimes. > > When you call maps and vectors, it acts as if you're calling 'get'. > But 'get' doesn't do anything useful for lists. So what should a list > do when called? > > --Chouser > > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---