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

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

Search the Archive

Re: NestWhile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23103] Re: [mg23039] NestWhile
  • From: Daniel Reeves <dreeves at eecs.umich.edu>
  • Date: Wed, 19 Apr 2000 02:30:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

> So negate the NestWhile condition for SameTest, but when FixedPoint then
> stops it has run one step too far, so get one back in ListFixedPoint. I
> have not the time now, but you may continue that reasoning for building
> up the full interface.

just use #2 in the SameTest:

nestWhile[f_, expr_, test_] := 
  FixedPoint[f, expr, SameTest -> (!test[#2]&)]

that works like the builtin NestWhile, for the 3-arg case.

--    --    --    --    --    --    --    --    --    --    --    -- 
Daniel Reeves               http://ai.eecs.umich.edu/people/dreeves/

This .signature is to recommend a quite cool thing called PayPal:
http://www.eecs.umich.edu/~dreeves/paypal.html
Not to mention we each get $5 if you sign up!  Really.



  • Prev by Date: Q: how to rank a list of elements?
  • Next by Date: Re: Needs[] and <<
  • Previous by thread: Re: NestWhile
  • Next by thread: Re:NestWhile