Re: [Q] How to get rid of {} ???
- To: mathgroup@smc.vnet.net
- Subject: [mg10726] Re: [Q] How to get rid of {} ???
- From: "P.J. Hinton" <paulh@wolfram.com>
- Date: Mon, 2 Feb 1998 00:44:20 -0500
- Organization: Wolfram Research, Inc.
- References: <6as8tj$f7i@smc.vnet.net>
On 30 Jan 1998, Alessandro Rossi wrote:
> Hi everyone again...
> I'm just curious to ask if is it possible to get rid of the {} simbols
> in a plain list of this kind {a1, a2, a3, ..., an} when you want to use
> the ordered sequence of a1, a2, a3, ..., an as arguments for a
> function.
>
> e.g.
> l
>
>
> If I have the following list:
> list={True, False, True}
>
> how can I computethe And Function of the three arguments of list:
>
> And[True, False, True]
>
> obviously
>
> And[list]
>
> doesn't work...
>
> It seems to me a very simple problem, but at the same time I really can
> not solve it. Any samaritan willing to give me some indication to solve
> this "Columbus Egg"???
And[Evaluate[Sequence @@ list]]
The use of Apply (@@) converts the List into a Sequence. Because the
And function has the attribute HoldAll, you have to throw an Evaluate
wrapper around the argument.
--
P.J. Hinton
Mathematica Programming Group paulh@wolfram.com Wolfram
Research, Inc. http://www.wolfram.com/~paulh/
Disclaimer: Opinions expressed herein are those of the author alone.