help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Dumb elisp question


From: Jambunathan K
Subject: Re: Dumb elisp question
Date: Fri, 30 Sep 2011 15:19:21 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt)

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

-- 



reply via email to

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