Re: simple question
- To: mathgroup at smc.vnet.net
- Subject: [mg99710] Re: simple question
- From: dh <dh at metrohm.com>
- Date: Tue, 12 May 2009 03:07:01 -0400 (EDT)
- References: <gu660n$9jh$1@smc.vnet.net>
Hi Francisco, your compare function is wrong. Try e.g.: {#1[[1]], #[1[2]]} =!= {#2[[1]], #2[[2]]} & Here is a simplified example: f = Max[0, # - 1] &; NestWhile[f, 10, #1 =!= #2 &, 2] Daniel Francisco Gutierrez wrote: > Dear Sirs: > I have a function whose output is of the form {{a,b,c},{d,e,f},k} > > That is, a list of length 3, of which the first two parts are lists and the last part is a number > > Now, I want to iterate it, with the following termination criterion: stop if the first two parts of the output are identical in two successive runs. > > The intuitive (or naively intuitive if you want) way of attacking the problem, I think, is the following: > > NestWhile[f,startinglist,UnsameQ[{#[[1]],#[[2]]}&,2] > > But it does not work. > > What is the solution? > Fg >