MathGroup Archive 2009

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

Search the Archive

Re: Bug with Sequence

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104636] Re: [mg104568] Bug with Sequence
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 5 Nov 2009 03:51:53 -0500 (EST)
  • References: <200911040634.BAA08584@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

It's not a bug. How can setting t[[1]] be interpreted to ELIMINATE t[[1]]?

The same thing happens if we enter:

x = Sequence[];
x

Sequence[]

x is Set, it's not eliminated.

If you want to drop a term at each step, no problem:

t = {1, 2, 3}; j = 0;
While[++j < 4, t = Rest@t; Print[t]]

{2,3}

{3}

{}

t

{}

Or:

t = {1, 2, 3}; j = 0;
While[++j < 4, t = Drop[t, 1]; Print[t]]

{2,3}

{3}

{}

t

{}

What serious work are you trying to do, where this is a problem... even if  
you DIDN'T have other ways to do what you really want?

Bobby

On Wed, 04 Nov 2009 00:34:10 -0600, dh <dh at metrohm.com> wrote:

>
>
> Hello,
>
> has anybody an explanation for the behavior of "Sequence"? I think it is
>
> an ugly bug.
>
> Consider the following that shoud succesively shorten the list t:
>
>
>
> t = {1, 2, 3}; j = 0;
>
> While[ ++j < 4, t[[1]] = Sequence[]; Print[t]]
>
>
>
> this returns: {2,3} three times.Dropping of the first element only seems
>
> to work once.
>
> If you say Information[t] you get:
>
> t={Sequence[],2,3}
>
>
>
> Daniel
>
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Bug with Sequence
  • Next by Date: Re: Re: Precise control of horizontal ticks with BarChart?
  • Previous by thread: Re: Bug with Sequence
  • Next by thread: Re: Bug with Sequence