From: "Herbert Euler" <herberteuler@hotmail.com>
Subject: Calling different kinds of functions, which finish the same job
Date: Tue, 11 Apr 2006 16:12:56 +0800 [thread overview]
Message-ID: <BAY101-F51C1368D833B75F2D0948DACD0@phx.gbl> (raw)
Hello,
Assume there are some functions, for instance, f1, f2, f3,
all of them are doing the same job, but with different arguments.
If I want to call one of them, but don't know which one is
actually called, how can I do that? I've written two macros
like
(defmacro xgp-casi2-safe-call-iter (func largs)
`(if ,largs
(condition-case nil
(apply ,func (car ,largs))
(error (xgp-casi2-safe-call-iter ,func (cdr ,largs))))))
(defmacro xgp-casi2-safe-call (func largs)
"Call function FUNC, try each element of LARGS, which is a list of list,
as argument to FUNC.
First call without arguments."
`(condition-case nil
(apply ,func)
(error (xgp-casi2-safe-call-iter ,func ,largs))))
And I will call it with
(xgp-casi2-safe-call function '((args of f1) (args of f2) (args of f3)))
This is my solution. Any suggestions? Thanks in advance.
Regards,
Guanpeng Xu
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
next reply other threads:[~2006-04-11 8:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-11 8:12 Herbert Euler [this message]
2006-04-11 15:49 ` Calling different kinds of functions, which finish the same job Kevin Rodgers
2006-04-11 17:31 ` Herbert Euler
2006-04-11 17:36 ` Herbert Euler
2006-04-11 18:36 ` Kevin Rodgers
2006-04-12 0:50 ` Herbert Euler
[not found] <mailman.318.1144803053.9609.help-gnu-emacs@gnu.org>
2006-04-12 3:55 ` Stefan Monnier
2006-04-12 15:28 ` Kevin Rodgers
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=BAY101-F51C1368D833B75F2D0948DACD0@phx.gbl \
--to=herberteuler@hotmail.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).