RE: Sequence and Or
- To: mathgroup at smc.vnet.net
- Subject: [mg34195] RE: [mg34179] Sequence and Or
- From: "DrBob" <majort at cox-internet.com>
- Date: Thu, 9 May 2002 05:15:56 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
Sorry. I don't misunderstand %, and that's not the problem, it's just
that I stupidly added the second line manually to the text without
evaluating it all again. I'll try again.
{True,False,True}
Or@@%
Sequence@@%%
Or[%]
Or[Sequence@@{True,False,True}]
evaluates to...
{True,False,True}
True
Sequence[True,False,True]
Sequence[True,False,True]
Sequence[True,False,True]
It's the last two outputs that mystify me, in which Sequence isn't
evaluated when it needs to be.
Bobby Treat
-----Original Message-----
From: Sseziwa Mukasa [mailto:mukasa at jeol.com]
To: mathgroup at smc.vnet.net
Subject: [mg34195] Re: [mg34179] Sequence and Or
On Wednesday, May 8, 2002, at 01:57 AM, DrBob wrote:
> When I evaluate the following...
>
> {True,False,True}
> Or@@%
> Sequence@@%
> Or[%]
>
This doesn't do what you are expecting if you place all the expressions
in the same cell in a notebook. The % in that case will refer to the
result of the last cell evaluated not the last expression evaluated. If
you place these expressions in different cells and evaluate the cells in
order you will get something closer to what you expect.
> the outputs are:
>
> {True,False,True}
> True
> Sequence[True,False,True]
> Sequence[True,False,True]
>
> while I had expected:
>
> {True,False,True}
> True
> Sequence[True,False,True]
This is actually wrong if you evaluate the expressions in separate
cells. At that point % refers to the value of Or@@{True,False,True}
which is True so you will see Sequence[True] here.
> True
>
> What am I missing?
>
I think you have a little misunderstanding of how % works.
Regards,
Ssezi