MathGroup Archive 2000

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

Search the Archive

Re: NestWhile


> 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