Re: Use pattern to find minimum without using min
- To: mathgroup at smc.vnet.net
- Subject: [mg71842] Re: Use pattern to find minimum without using min
- From: dh <dh at metrohm.ch>
- Date: Fri, 1 Dec 2006 06:21:40 -0500 (EST)
- References: <ekmdbc$7th$1@smc.vnet.net>
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. >