unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Dumb elisp question
Date: Fri, 30 Sep 2011 15:19:21 +0530	[thread overview]
Message-ID: <81oby24axq.fsf@gmail.com> (raw)
In-Reply-To: <87ty7uz8zr.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Fri, 30 Sep 2011 17:15:36 +0800")


I think you are looking for this:

(apply 'format "%s %s" '("one" "two"))

> I've made a function that takes as arguments an arbitrary format string
> and a list of arguments to that string. The list of arguments is of
> varying length, and the args need to be mapped through a function before
> they're passed to the format string. So in the bowels of the function
> there's something like:
>
> (format fmt-str-var (mapcar (lambda (arg) (do-thing-with arg))
> list-of-arguments))
>
> Obviously, the problem is that mapcar returns a single list of strings,
> not the series of atomic strings that format requires.


> I've tried to solve this problem many different ways, including turning
> this into a macro and using ",@", and using ",@" even when it's not a
> macro, and looking at other mapping functions, and trying to make some
> sort of "splice" function of my own, and… and…
>
> Nothing works quite right. This can't be a macro because elsewhere it
> needs to pass `commandp'. I can't make any of the other fixes work
> properly.
>
> Can anyone provide an elegant solution?
>
> Thanks,
> Eric

-- 



  parent reply	other threads:[~2011-09-30  9:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30  9:15 Dumb elisp question Eric Abrahamsen
2011-09-30  9:18 ` Le Wang
2011-09-30  9:49 ` Jambunathan K [this message]
2011-09-30 13:12   ` Eric Abrahamsen
2011-10-01 12:11     ` Le Wang

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=81oby24axq.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /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).