all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: "Pascal J. Bourguignon" <pjb@informatimago.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Evaluation of macro arguments
Date: Tue, 05 Jan 2016 20:39:28 +0100	[thread overview]
Message-ID: <874merstn3.fsf@mbork.pl> (raw)
In-Reply-To: <87h9irn85y.fsf@kuiper.lan.informatimago.com>



On 2016-01-05, at 20:22, Pascal J. Bourguignon <pjb@informatimago.com> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> Hi all,
>>
>> continuing my quest to grok macro argument evaluation issues, I'd like
>> (again) to make sure that I get it correctly.  So I have this simple
>> macro generating a list of consecutive numbers (which is not without
>> problems - I am aware of those, namely (i) it uses hard-coded symbols
>> instead of generating them on the fly, and (ii) it has no error
>> checking):
>>
>> (defmacro range (from dir to)
>>   `(let ((delta (cond ((eq ',dir 'upto) 1)
>>                       ((eq ',dir 'downto) -1)))
>>          (i ,from)
>>          (list nil))
>>      (while (not (= i ,to))
>>        (push i list)
>>        (setq i (+ i delta)))
>>      (nreverse list)))
>
> (let ((i 0))
>    (list (range  i 'upto (incf i 10))  ; bam!
>          i))
>
> I hope you may debug it well.

That's unfair, Pascal; I wrote that I'm aware of this, I know how to
make it work, and wasn't asking about it.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



  reply	other threads:[~2016-01-05 19:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 10:59 Evaluation of macro arguments Marcin Borkowski
2016-01-05 12:55 ` Stefan Monnier
2016-01-13 22:16   ` Marcin Borkowski
2016-01-14 13:47     ` Stefan Monnier
2016-01-14 20:32       ` Marcin Borkowski
2016-01-14 23:05         ` Stefan Monnier
2016-01-05 19:22 ` Pascal J. Bourguignon
2016-01-05 19:39   ` Marcin Borkowski [this message]
2016-01-05 20:30     ` Marcin Borkowski
     [not found]     ` <mailman.1794.1452025850.843.help-gnu-emacs@gnu.org>
2016-01-08 23:13       ` duthen.mac.01

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874merstn3.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pjb@informatimago.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.