is_function vs tuples (functions in non-local modules)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

is_function vs tuples (functions in non-local modules)

Fredrik Linder-2
You could use erlang:function_exported/3.

/Fredrik

> -----Original Message-----
> From: owner-erlang-questions
> [mailto:owner-erlang-questions]On Behalf Of David N. Welton
> Sent: den 11 juni 2004 12:21
> To: erlang-questions
> Subject: is_function vs tuples (functions in non-local modules)
>
>
> Here's another one that's got me scratching my head:
>
> 1> c(parser).
> {ok,parser}
> 2> parser:tr("x").
> "<tr>x</tr>"
> 3> Fun = {parser, tr}.
> {parser,tr}
> 4> Fun("x").
> "<tr>x</tr>"
> 5> {parser, tr}("x").
> "<tr>x</tr>"
> 6> is_function(Fun).
> false
> 7> is_function({parser, tr}).
> false
>
> Is there any way to tell?
>
> Reason being, I want to pass a list of things to a function.  This
> function should only call the ones that are actually
> functions.  I guess
> I could use catch, but that's got it's own problems (if it is
> a function
> and it errors out, I want the error to be passed on up) and
> doesn't seem
> elegant.
>
> Thankyou once again for your time,
> --
> David N. Welton
> davidw
>