Re: Use pattern to find minimum without using min
- To: mathgroup at smc.vnet.net
- Subject: [mg71845] Re: [mg71808] Use pattern to find minimum without using min
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 1 Dec 2006 06:21:43 -0500 (EST)
- Reply-to: hanlonr at cox.net
{9, 4, 6, 5, 3, 7} //. {{a___, b_, c___, d_, e___} :> {a,b,c,e} /; (b < d), {a___, d_, c___, b_, e___} :> {a,b,c,e} /; (b < d)} {3} {9, 4, 6, 5, 3, 7}//Sort//First 3 Bob Hanlon ---- wooks <wookiz at hotmail.com> 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. >