Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Use pattern to find minimum without using min

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71858] Re: Use pattern to find minimum without using min
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Fri, 1 Dec 2006 06:22:11 -0500 (EST)
  • References: <ekmdbc$7th$1@smc.vnet.net>

First Sort the elements then pick up the first element of the list

lst = Table[Random[Integer, {3, 20}], {20}]
{14, 19, 8, 13, 18, 9, 6, 5, 13, 10, 12, 13, 11, 14, 12, 19, 16, 17,
14, 17}

lst //. {a___, b_, f___, c_, d___} /; c < b -> {a, c, d}
% /. {x_, y___} -> x

{5, 10, 11, 12, 14, 17}
5

Regards
Dimitris

Ï/Ç wooks Ýãñáøå:
> Tried
>
> {9, 4, 6, 5, 3, 7} //. {a___, b_, c___, d_, e___} :> b /; (b < d)
>
> and
>
> {9, 4, 6, 5, 3, 7} //. {x_,y_,z___} :> {x,z} /; (x<y)
> 
> without much success.


  • Prev by Date: Re: Use pattern to find minimum without using min
  • Next by Date: Re: Use pattern to find minimum without using min
  • Previous by thread: Re: Use pattern to find minimum without using min
  • Next by thread: Re: Use pattern to find minimum without using min