MathGroup Archive 2010

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

Search the Archive

Re: Behavior of Longest

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107932] Re: [mg107909] Behavior of Longest
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 3 Mar 2010 05:51:07 -0500 (EST)
  • References: <201003021254.HAA14195@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

The second example really does look wrong:

{1, 2} /. Longest[x__Integer] :> {x}

{{1}, {2}}

Bobby

{1, 2} /. Shortest[x__Integer]:>{x}  gives {{1}, {2}}

On Tue, 02 Mar 2010 06:54:27 -0600, dh <dh at metrohm.com> wrote:

> Hello,
> can somebody give an explanation for the following behavior of Longest
> (Mathematica version 7.0.1):
> {1, 2} /. Longest[x__Integer]:>{x}    gives {{1}, {2}}
>
> the same as Shortest:
> {1, 2} /. Shortest[x__Integer]:>{x}  gives {{1}, {2}}
>
> However, it works like expected in the following case:
> {a, 1, 2, b} /. {x1___, Longest[x__Integer], x2___} :> {x1, {x}, x2}
> gives: {a, {1, 2}, b}
>
> looks like a bug to me.
>
> Daniel
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: edge labels
  • Next by Date: Re: "changebit" front-end option for Demonstrations NBs
  • Previous by thread: Behavior of Longest
  • Next by thread: Re: Behavior of Longest