[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on pcase
From: |
Andreas Schwab |
Subject: |
Re: Question on pcase |
Date: |
Mon, 26 Oct 2015 17:35:40 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Oleh Krehel <address@hidden> writes:
> But the code that binds the variables, e.g. (setq thing x) will likely
> be hard to implement. For instance, look at this example with macroexpand:
>
> (setq test '(1 . 2))
> (pcase test
> (`(,foo . ,baz)
> (cons baz foo)))
> ;; =>
> ;; (2 . 1)
>
> (macroexpand '(pcase test
> (`(,foo . ,baz)
> (cons baz foo))))
> ;; =>
> ;; (if (consp test)
> ;; (let* ((x (car test))
> ;; (x (cdr test)))
> ;; (let ((baz x)
> ;; (foo x))
> ;; (cons baz foo)))
> ;; nil)
>
> The macroexpanded code returns (2 . 2) when evaluated. This I don't
> understand.
Try binding print-gensym and print-circle to non-nil while the form is
printed.
Andreas.
--
Andreas Schwab, SUSE Labs, address@hidden
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
- Re: Question on pcase, (continued)
- Re: Question on pcase, Michael Heerdegen, 2015/10/26
- Re: Question on pcase, Oleh Krehel, 2015/10/27
- Re: Question on pcase, Michael Heerdegen, 2015/10/27
- Re: Question on pcase, Michael Heerdegen, 2015/10/27
- Re: Question on pcase, Michael Heerdegen, 2015/10/28
- Re: Question on pcase, Oleh Krehel, 2015/10/29
- Re: Question on pcase, Michael Heerdegen, 2015/10/29
- Re: Question on pcase,
Andreas Schwab <=