[parenscript-devel] [PATCH] Extend CHAIN to support slot-values
Vladimir Sedach
vsedach at gmail.com
Sun Sep 13 22:20:23 UTC 2009
Pushed. Thanks for the patch Daniel!
On Thu, Sep 10, 2009 at 11:33 PM, Daniel White <daniel at whitehouse.id.au> wrote:
> For example:
> (chain ($ "foo") (bar x z) frob (baz 5) =>
> $('foo').bar(x, z).frob.baz(5);
> ---
> src/lib/ps-macro-lib.lisp | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/src/lib/ps-macro-lib.lisp b/src/lib/ps-macro-lib.lisp
> index be90b79..2ef7d82 100644
> --- a/src/lib/ps-macro-lib.lisp
> +++ b/src/lib/ps-macro-lib.lisp
> @@ -84,7 +84,9 @@
> (defpsmacro chain (&rest method-calls)
> (labels ((do-chain (method-calls)
> (if (cdr method-calls)
> - `((@ ,(do-chain (cdr method-calls)) ,(caar method-calls)) ,@(cdar method-calls))
> + (if (listp (car method-calls))
> + `((@ ,(do-chain (cdr method-calls)) ,(caar method-calls)) ,@(cdar method-calls))
> + `(@ ,(do-chain (cdr method-calls)) ,(car method-calls)))
> (car method-calls))))
> (do-chain (reverse method-calls))))
>
> --
> 1.6.4.2
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
More information about the parenscript-devel
mailing list