Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Max Consecutive Occurrence.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47660] Re: Max Consecutive Occurrence.
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 21 Apr 2004 05:22:58 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <c62k0d$rhi$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

and

lst = {a, a, a, a, b, b, b, a, a, a, a, a, a, a, c, a, a, a, a, a, a, a,
a};

MaxConsecutiveOccurrence[lst_, what_] := 
    Max[Length /@ Cases[Split[lst], {what ..}]]
    

does not what you want ??

Regards
  Jens

"Robert G. Wilson v" wrote:
> 
> Mathematica had many programmed functions which are not referenced in the
> help index. Under '?Position -> Further Examples' you will find two such
> functions, 'ConsecutiveOccurrences1' and 'ConsecutiveOccurrences2.' I
> first wish that Mathematica would index these.
> 
> But the reason for writing is that I have a need for a function named
> 'MaxConsecutiveOccurrence' which would return the maximum consecutive
> occurrence of x in a list.
> 
> Thank you in advance.
> 
> Bob.


  • Prev by Date: Re: Max Consecutive Occurrence.
  • Next by Date: RE: Max Consecutive Occurrence.
  • Previous by thread: Re: Max Consecutive Occurrence.
  • Next by thread: RE: Max Consecutive Occurrence.