emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pcase.el


From: Ted Zlatanov
Subject: Re: pcase.el
Date: Tue, 28 Sep 2010 13:17:22 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

On Mon, 27 Sep 2010 00:06:13 +0200 Stefan Monnier <address@hidden> wrote: 

SM> The docstring of `pcase' is meant to be "complete", so you can start
SM> with that and complain about the missing bits.  
...
SM> There's a fairly good/extensive example in macroexp.el.

That was helpful, thank you.  I played with it a bit:

(loop for form in '("hello string"
                    ("hello list")
                    30
                    symbol
                    (lambda () ("lambda"))
                    (what about me))
      collect `(,form
                "pcased is"
                ,(pcase form
                   (`(lambda . ,_)
                    "lambda function")
                   (`30 :thirty)
                   ((pred stringp) "that was a string")
                   (`(what . ,what-args)
                    (format "what with args %s" what-args))
                   ((pred listp) "that was a list")
                   (t (format "couldn't match \"%s\"" form)))))

I'll keep it in mind.  

The docstring should maybe mention the t pattern (to match anything).
It's functionally equivalent to _ but I think the SYMBOL pattern matches
it...  So what happens to the SYMBOL value bind?

Thanks
Ted




reply via email to

[Prev in Thread] Current Thread [Next in Thread]