MathGroup Archive 1997

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

Search the Archive

Re: Until -Reply -Reply

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7235] Re:[mg7063] Until -Reply -Reply
  • From: Sean Ross <sean at mail.creol.ucf.edu>
  • Date: Sat, 17 May 1997 19:13:28 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Sean:

>The forms:
>.....; or yours
> Until[test_,body_]:=While[test=!=True,body]; 
>work fine, but are not a true Until because they don't execute body first.

Mine is

SetAttributes[Until,HoldAll]
Until[test_, body_]:= While[body;test=!=True]

and does execute body first:

i=1;Until[True,i++];i 

	2
	
Am I missing something?

Allan Hayes


Thanks for the help.  Your code does work and yes, you are missing
something.  As an "insider", you were aware of an undocumented While
feature when I assumed that your While[body,test] was just a typo that I
saw no need to quibble about.  The mathematica book does not mention
that While[test,body] evaluates test first, then body and While[body,test]
does the reverse.  I will promptly "Update" my personal copy of the
mathematica book.  This would probably make a nice addition to the list of
revisions you are compiling somewhere.


  • Prev by Date: Re: Pentium bug
  • Next by Date: Re: [q]contour integral
  • Previous by thread: Re: Re: Until -Reply
  • Next by thread: Re: Re: Until -Reply -Reply