Re: BlankSequence
- To: mathgroup at smc.vnet.net
- Subject: [mg59189] Re: BlankSequence
- From: "dkr" <dkrjeg at adelphia.net>
- Date: Mon, 1 Aug 2005 01:05:02 -0400 (EDT)
- References: <dchois$864$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
You are attempting to Map over a Sequence.
In[50]:=
g[lista__]:={#}&/@lista;
In[51]:=g[{1,2}]
Out[51]={{1},{2}}
(* Here we are effectively mapping over the list {1,2} *)
In[55]:=Trace@g[{1,2},{3,4}]
Out[55]=
{g[{1,2},{3,4}],Map[{#1}&,{1,2},{3,4}],{1,2}}
(* Here the list {3,4} is interpreted as a level spec, and since the
levels are not present, the original list {1,2} is returned *)
In[56]:=
Trace@g[{1,2},{1,1}]
Out[56]=
{g[{1,2},{1,1}],
Map[{#1}&,{1,2},{1,1}],{({#1}&)[1],({#1}&)[2]},{({#1}&)[1],{1}},{({#1}&)[
2],{2}},{{1},{2}}}
(* Here the pure function is applied to Level 1 *)
In[57]:=
Trace@g[{1,2},{3,4},{5,6}]
Map::nonopt: Options expected (instead of {5,6}) beyond position 3 in \
Map[{#1}&,{1,2},{3,4},{5,6}]. An option must be a rule or a list of
rules.
(* Here an error message is generated *)
Reformulate your problem so you are mapping over {lista}, not lista.