public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: "Sudarshan S Chawathe" <chaw@eip10.org>
To: Per Bothner <per@bothner.com>
Cc: kawa <kawa@sourceware.org>
Subject: Re: Using #!optional, #!rest, and #!key together
Date: Sun, 23 Apr 2017 19:24:00 -0000	[thread overview]
Message-ID: <5757.1492975493@vereq.eip10.org> (raw)
In-Reply-To: Your message of "Sat, 22 Apr 2017 18:11:57 -0700."             <792B84DD-C6FA-4C57-9241-4FC0E59A9F3C@bothner.com>

> I'm in a location with unexpectedly very bad connectivity. Check the
> invoke branch. It allows #!Rest *after* #!Key. See Application and
> arguments list in manual.

Thanks for the suggestion!  (I'm not sure why I switched back to master
from invoke a while back.)

I just switched over to the invoke branch and "rest after key" arguments
seems to work as expected (and also seems forgiving about ignoring extra
arguments).

The rest is just for completeness, in case it helps someone down the
road...

(define-syntax list/names
  (syntax-rules ()
    ((_ name ...) (list (cons 'name name) ...))))

(define test-args-2
  (lambda (a b #!optional c d #!key (f 'vf) (g 'vg) #!rest e)
    (list/names a b c d f g e)))

(test-args-2 1 2 3 4 f: 6 g: 7 5)
;; => ((a . 1) (b . 2) (c . 3) (d . 4) (f . 6) (g . 7) (e 5))

(test-args-2 1 2 3 4 f: 7 g: 8 5 6)
;; => ((a . 1) (b . 2) (c . 3) (d . 4) (f . 7) (g . 8) (e 5 6))

;; The next two are really errors.

(test-args-2 1 2 3 4 5 f: 6 g: 7)
;; => ((a . 1) (b . 2) (c . 3) (d . 4) (f . 6) (g . 7) (e))

(test-args-2 1 2 3 4 5 6 f: 7 g: 8)
;; => ((a . 1) (b . 2) (c . 3) (d . 4) (f . 7) (g . 8) (e))


Regards,

-chaw

       reply	other threads:[~2017-04-23 19:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <792B84DD-C6FA-4C57-9241-4FC0E59A9F3C@bothner.com>
2017-04-23 19:24 ` Sudarshan S Chawathe [this message]
2017-04-23 19:29   ` Per Bothner
2017-04-19 15:22 Sudarshan S Chawathe

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=5757.1492975493@vereq.eip10.org \
    --to=chaw@eip10.org \
    --cc=kawa@sourceware.org \
    --cc=per@bothner.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).