MathGroup Archive 2005

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

Search the Archive

Re: BlankSequence

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59194] Re: BlankSequence
  • From: dh <dh at metrohm.ch>
  • Date: Mon, 1 Aug 2005 01:05:12 -0400 (EDT)
  • References: <dchois$864$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Daniele,
consider the following function:
f1[Lista__,options___]:= ...
lista can have at least 1 argument, options 0 or more. Note that we now 
have several ways to assigne arguments to lista and options. Define now:
f1[lista__, options___] := Module[{listaUV},
     Print["Lista=", {lista}];
     Print["Options=", {options}];
]
and try:
f1[1,2]
this gives
Lista={1}
Options={2}
further try:
f1[1,2,3]
gives:
Lista={1}
Options={2,3}
certainly not what you expected.
Here is work around:
f2[{lista__},options___]:=..
Note that if you redefine the left hand side, make sure you first clear 
the symbol, e.g. Clear[f2].

Further, you can not Map a function to a Sequence like in your example:
listaUV = {...} & /@ lista
You must Map to a List:
listaUV = {...} & /@ {lista}

sincerely, Daniel

Daniele Lupo wrote:
> Hi to everyone.
> 
> I'm woking with a function, and I've a problem with the blank sequence. My
> function is defined in this way:
> 
> ListSmith[lista__, options___]:= Module[{listaUV},
> listaUV = {RXToU[#[[1]], #[[2]]], RXToV[#[[1]], #[[2]]]} & /@ lista;
> MultipleListPlot[listaUV, options]
> ]
> 
> Now, when I put a single list as augment of the function, in this way
> 
> ListSmith[list1, PlotJoined->True]
> 
> All works OK. When I define more lists, instead, in this way, for example:
> 
> ListSmith[list1, list2, PlotJoined->True]
> 
> both lists are drawn, but only the first is elaborated by the first command
> of the function, while the second list (and others, when they are present),
> are not modified in listaUV.
> 
> I'd like to modify every list that appears like augment in my function,
> instead that only the first.
> 
> Anyone has some idea about it?
> 
> Thanks for answers
> 
> Daniele
> 
> 


  • Prev by Date: Some bugs in Mathematica
  • Next by Date: Re: Interpolation of function
  • Previous by thread: Re: BlankSequence
  • Next by thread: Re: BlankSequence