Re: [alexandria-devel] [PATCH] PROG1-LET

2012-04-12 Thread Attila Lendvai
Certainly. I've been experimenting with a compiler backed by LLVM, and using its IR builder, I often wish to create a function, define its body, then return the function. This usually takes the form of: (prog1-let (func (llvm:add-function ...))  (setf (llvm:linkage func) :internal [...]

Re: [alexandria-devel] [PATCH] PROG1-LET

2012-04-10 Thread Benjamin Saunders
On Tue, Apr 10, 2012 at 10:13:33AM +0300, Nikodemus Siivola wrote: WHEN-LET and IF-LET have a fairly common use-case ... where in a typical case the /relative/ reduction in lines of code is a substantial 33% -- and they are also classic: been around forever, re-invented independently by

Re: [alexandria-devel] [PATCH] PROG1-LET

2012-04-08 Thread Liam Healy
On Sat, Apr 7, 2012 at 4:34 PM, Nikodemus Siivola nikode...@random-state.net wrote: On 7 April 2012 23:25, Benjamin Saunders ral...@gmail.com wrote: PROG1-LET is a binding macro modeled closely after WHEN-LET and friends, which I have regularly found useful in code to implement the

Re: [alexandria-devel] [PATCH] PROG1-LET

2012-04-08 Thread Benjamin Saunders
On Sun, Apr 08, 2012 at 12:33:55PM +0200, Tamas K Papp wrote: I usually ... implement this pattern using the ANAPHORA library. Your macro would of course be a better solution if, for some reason, one doesn't want to use an anaphoric macro Yeah, that's the idea. As with all the other macros in

Re: [alexandria-devel] [PATCH] PROG1-LET

2012-04-08 Thread Benjamin Saunders
On Sun, Apr 08, 2012 at 06:24:33PM +0600, Attila Lendvai wrote: it's not substantially shorter than the alternatives True. However, the same can be said of every other macro in bindings.lisp, and this does not seem to have precluded their inclusion. It certainly does not preclude my glad use of

[alexandria-devel] [PATCH] PROG1-LET

2012-04-07 Thread Benjamin Saunders
PROG1-LET is a binding macro modeled closely after WHEN-LET and friends, which I have regularly found useful in code to implement the create, modify, return pattern common in some imperative code. As a simple and, I believe, widely useful macro, I'd like to see this enter into Alexandria proper.