MathGroup Archive 2006

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

Search the Archive

Re: Use pattern to find minimum without using min



Hi,

your logic is wrong.

Here are two possibilities:

{9, 4, 6, 5, 3, 7} //. {{a___,

     b_, c_, d___} :> {a, b, d} /; (b < c), {a___, b_, c_, d___} :> {

       a, c, d} /; (b > c)}

or

{9, 4, 6, 5, 3, 7} //. {a___, b_, c_, d___} :>

    If[b < c, {a, b, d}, {a, c, d}]

by the way, why do you despise "Min?"

Daniel



wooks wrote:

> 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: Drawing function with 3 variables in a graph
  • Previous by thread: Re: Use pattern to find minimum without using min
  • Next by thread: Re: Drawing function with 3 variables in a graph