Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: returning variable number of arguments from a Module[ ]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71552] Re: returning variable number of arguments from a Module[ ]
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 23 Nov 2006 05:41:21 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <ejs38c$94b$1@smc.vnet.net>

Hi,

f[x_,y_]:= Module[ {t,s} , t=x+y; s = t*y; 
s,t}  ]

and

{ W, Y } = f[x,y]

work fine.

And in the case that
f[x_,y_]:= Module[ {t,s} , t=x+y; s = t*y;
              If[TrueQ[$strage], s, {s,t}]
             ]

you will get a single value with

Block[{$strange=True},f[x,y]]

otherwise the pair

Regards
 Jens

"bd satish" <bdsatish at gmail.com> schrieb im 
Newsbeitrag news:ejs38c$94b$1 at smc.vnet.net...
| Hi ,
|
|         Is there any method to return a variable 
number of arguments from a
| Module[ ] or Block[ ] depending upon the o/p 
list ?
|
| For example, consider a module
|
|          f[x_,y_]:= Module[ {t,s} , t=x+y; s = 
t*y  ]
|
| Also  assume that , the variable 's' has higher 
priority than 't' . So when
| a user types a single o/p variable i.e.
|
| W = f[x,y]                then W should have the 
same value as 's' in the
| module
|
| { W, Y } = f[x,y]        then W points to 's' 
and 'X' points to 't'
|
| If I try to do the above ,I'm getting some 
warning messages..
|
| Please help.
|
| 



  • Prev by Date: Re: 1`2 == 1*^-10
  • Next by Date: Re: Bookmarks in Mathematica ????
  • Previous by thread: Re: Re: returning variable number of arguments from a Module[ ]
  • Next by thread: symbolic solution of ODE