MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Questions about functions.


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11813] Re: Questions about functions.
  • From: Allan Hayes <hay@haystack.demon.co.uk>
  • Date: Tue, 31 Mar 1998 02:28:31 -0500
  • References: <6esdkf$57j@smc.vnet.net> <6f1lvm$f9n@smc.vnet.net> <6fi7ca$4ri@smc.vnet.net>

El alchemista wrote:
> 1 - How can I convert the sequence of all arguments of a function  into
> a list ?              In vain I tried      f[x__] := List @@ x
> 
> 2 - How can I make functions which use their own names , for instance so
> that   s[e,f]   for some symbol   s   and all expressions    e , f
> becomes    (s+e)(s+f)  ?

How about

f[x__] := {x }

f[1,2]

{1,2}


s[e_,f_]  :=  (s+e)(s+f)  

s[x,y]

(s+x) (s+y)

-- 
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642



  • Prev by Date: Re: reading Fortran unformatted files
  • Next by Date: Re: Speed of writing in Mathematica 3.01
  • Prev by thread: RE: Questions about functions.
  • Next by thread: Re: Questions about functions.