Re: Turning the elements of a list into the arguments of a function.
- To: mathgroup at smc.vnet.net
- Subject: [mg8849] Re: Turning the elements of a list into the arguments of a function.
- From: Julian Stoev <stoev at SPAM-RE-MO-VER-usa.net>
- Date: Tue, 30 Sep 1997 20:16:10 -0400
- Organization: Seoul National University, Republic of Korea
- Sender: owner-wri-mathgroup at wolfram.com
On 29 Sep 1997, Scott Morrison wrote:
[del]
|I need to be able to convert
|f[q, {{a,b}, {c,d}}] into f[q, {a,b}, {c,d}]
[del]
Yes, I have at least one idea. The best one I think is to use
transformation rules:
Here you are an example:
In[1]:=
f[q, {{a,b}, {c,d}}] /.f_[q_,{l1__}]->f[q,l1]
Out[1]=
f[q, {a, b}, {c, d}]
And it works for any number of arguments in the list:
In[2]:=
f[q, {{a,b}, {c,d},{e,f}}] /.f_[q_,{l1__}]->f[q,l1]
Out[2]=
f[q, {a, b}, {c, d}, {e, f}]
Hope this helps!
--------------------------------------------------------------------------
Julian Stoev <j.h.stoev at ieee.org> - Ph. D. Student
Intelligent Information Processing Lab. - Seoul National University, Korea
Work: 872-7283, Home: 880-4191 - http://poboxes.com/stoev
!!!!! Use REPLY-TO: or remove "SPAMREMOVER" in my address