[ANN] cadr: `car', ..., `cddddr' in Clojure

2011-11-30 Thread Peter Danenberg
Try as I might, I can't purge these anachronisms; so here are `car' to `cr' in all their glory: http://clojars.org/cadr This implementation uses a Kleene-closure around the alphabet {a, d} to generate the names; and a macro to define them: https://github.com/klutometis/cadr/blob/master/s

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

2011-12-01 Thread Peter Danenberg
(macroexpand-1 '(with-cxrs (inc (caadaaddadr x > (let [caadaaddadr (comp first first rest first first rest rest first > rest)] > (inc (caadaaddadr x))) > > On Nov 30, 11:27 pm, Tassilo Horn wrote: > > Peter Danenberg writes: > > > > Hi Peter,

Re: stack overflow vs scheme

2011-12-02 Thread Peter Danenberg
Quoth john.holland on Sweetmorn, the 44th of The Aftermath: > It seems to me that as general solutions to stack overflow, > trampoline and recur are very valuable. I had gotten the mistaken > idea that Scheme was somehow immune to the problem. Trampoline and recur are a poor man's tail-call-optimi

Re: on lisp and scheme macros

2011-12-03 Thread Peter Danenberg
This talk of "Scheme macros" is a little weird: are we talking syntax-case, explicit-renaming, or unhygienic defmacro? Scheme has them all. There are also implementation-specific mechanisms for writing reader macros: what's left? On Dec 3, 2011, at 14:57, Stuart Sierra wrote: > I think that

Re: let-else macro

2011-12-07 Thread Peter Danenberg
Thanks, Evan; I had a use-case where the truthiness of nil would have forced me out of `let-else.' This new predicate-abstraction is beautiful. Quoth Evan Gamble on Sweetmorn, the 49th of The Aftermath: > Thanks for your comment, Sam. > > Before you posted the comment, Peter Danen

[ANN] reader-macros

2011-12-21 Thread Peter Danenberg
Despite Brian Carpenter's warning about torches and pitchforks [1], I've decided to release a reader-macros package; may Zeus forgive me for opening this pithos: https://github.com/klutometis/reader-macros Here's a trivial example where we implement a reverse-string reader: (use '[clojure.st

Re: [ANN] reader-macros

2011-12-21 Thread Peter Danenberg
Whoops: that's Brian Carper, not Carpenter. Quoth Peter Danenberg on Setting Orange, the 63rd of The Aftermath: > Despite Brian Carpenter's warning about torches and pitchforks [1], > I've decided to release a reader-macros package; may Zeus forgive me > for opening t

Re: [ANN] reader-macros

2011-12-21 Thread Peter Danenberg
Quoth Aaron Cohen on Setting Orange, the 63rd of The Aftermath: > Ha, I just looked at the source, it's really weird to see λ in > "clojure" code. That's a little idiosyncrasy of mine: I've been chastised for it in the past; maybe `lambda' would be more readable? -- You received this message bec

Re: [ANN] reader-macros

2011-12-21 Thread Peter Danenberg
Quoth Aaron Cohen on Setting Orange, the 63rd of The Aftermath: > One thing I'd really want before I even considered using this would > be some way of restricting the scope of a reader macro to the > current file. As is, they just have way too much room to interfere > with your whole world. I'm not

Re: [ANN] reader-macros

2011-12-21 Thread Peter Danenberg
Quoth Aaron Cohen on Setting Orange, the 63rd of The Aftermath: > Oh excuse me, I was misreading what is going on here with the > lambda. I thought it was a reader macro, but you're just pulling > that alias in from some dependency. Exactly: `λ' and `defλ' are just vanilla macros that shadow `fn'

Why are body-macros more fashionable than thunks?

2011-12-22 Thread Peter Danenberg
Scheme, for instance, obeys the Law of Macro-Parsimony: "don't use defmacro," namely, "where defn will suffice;" Clojure, on the other hand, is macro-liberal. In other words, everyone seems to prefer e.g. `(defmacro foo [vars & body] `(do ... ~@body))' where `(defn foo [vars thunk] ... (thunk))' w

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Peter Danenberg
all things. Quoth Cedric Greevey on Sweetmorn, the 64th of The Aftermath: > On Thu, Dec 22, 2011 at 4:54 PM, Peter Danenberg wrote: > > Scheme, for instance, obeys the Law of Macro-Parsimony: "don't use > > defmacro," namely, "where defn will suffice;"

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Peter Danenberg
Quoth Kevin Downey on Sweetmorn, the 64th of The Aftermath: > Why do you care? SICP-forged neural pathways, basically; I'll end up writing e.g.: (defn with-input-from-file [file thunk] ...) only to censor myself: "shit, we don't do thunks." At that point, I'll bust out `defmacro' with relucta

Re: Clojure list syntax sugar: f(x) notation

2011-12-28 Thread Peter Danenberg
Quoth Louis Yu Lu on Boomtime, the 70th of The Aftermath: > The proposed syntax sugar apparently pleases my eyes and fingers > from conventional languages. With some experiments, I found the code > is more readable for me to use f(x) notation for function call, and > (op x) for operator. It sounds

Re: Clojure list syntax sugar: f(x) notation

2011-12-28 Thread Peter Danenberg
Since square brackets have been usurped by vectors, angle brackets could be used to approximate M-expressions. Quoth Ambrose Bonnaire-Sergeant on Boomtime, the 70th of The Aftermath: > Why not use f ? > > On Thu, Dec 29, 2011 at 12:49 PM, Louis Yu Lu wrote: > > > Instead of using overloaded (),