Re: cadr: `car', ..., `cddddr' in Clojure

2011-12-01 Thread Peter Danenberg
This is fantastic, Alan; I haven't gotten around to LoL yet, but maybe I should. Quoth Alan Malloy on Setting Orange, the 43rd of The Aftermath: > LoL lets you write: > > (with-cxrs > (blah (foo (bar (cadddar x) > > ie, it looks in your source, sees what you need defined, and makes a > let

Re: cadr: `car', ..., `cddddr' in Clojure

2011-12-01 Thread Tassilo Horn
Alan Malloy writes: Hi Alan, > LoL lets you write: > > (with-cxrs > (blah (foo (bar (cadddar x) > > ie, it looks in your source, sees what you need defined, and makes a > letfn. Ah, even better. Or well, not better, if you have too many x-es. There I'd prefer to give shorter names to my

Re: cadr: `car', ..., `cddddr' in Clojure

2011-12-01 Thread Alan Malloy
(btw I threw this together just before bed, so it's not perfect. One thing that's wrong is it assumes (name x) can be called on any x; but it can't be called on lots of things, like numbers. So you'd need to filter those out, and also fix a couple other bugs. On Dec 1, 2:12 am, Alan Malloy wrote:

Re: cadr: `car', ..., `cddddr' in Clojure

2011-12-01 Thread Alan Malloy
LoL lets you write: (with-cxrs (blah (foo (bar (cadddar x) ie, it looks in your source, sees what you need defined, and makes a letfn. This looked fun, so I banged out an implementation: (defn cxr-impl [name] (when-let [op (second (re-matches #"c([ad]+)r" name))] `(comp ~@(map {\a `