Re: Get list of function variables?
- To: mathgroup at smc.vnet.net
- Subject: [mg83516] Re: Get list of function variables?
- From: Szabolcs <szhorvat at gmail.com>
- Date: Thu, 22 Nov 2007 04:40:53 -0500 (EST)
- References: <fhjs5v$4t3$1@smc.vnet.net> <fhu7j5$7b1$1@smc.vnet.net>
On a second thought, there *are* functions in Mathematica which more
or less correspond to the function concept of other languages. They
can be defined as
f = #^2 &
or
f = Function[{x}, x^2]
They are less flexible than the pattern definitions, but have the
advantage that they can be specified inline (with the #^2& syntax) and
can be automatically compiled for performance. You'd need a separate
definition for getVariables to make it work on these kinds of
functions.
Szabolcs