From: 	Yehuda Katz[SMTP:yehuka@beitberl.beitberl.ac.il]
Sent: 	Sunday, October 06, 1996 12:15 PM
To: 	Logo-L
Subject: 	Re: LOGO-L> Tracing InsertSort

George Mills <mills@ultranet.com> wrote:
> 
> Yehuda Katz wrote:
> >
> > Hello Prof. Neuwirth in Vienna,
> >
> > I'm not new to Logo, but can't remember the time I used TRACE. Taking
> > your advice, I TRACEd the two versions only to discover what a strong
> > debugging (and instructive) tool I missed all that time: Without it, how
> > could I guess that REDUCE reads its list in REVERSED order? So *that's*
> > why you wrote LPUT [] :L (!!!).
> >
> > I said more then once, that a good way to learn programming is watching
> > others' programs.
> >
> > So I thank you twice: For the InsSort program (a great example of using
> > REDUCE), and for the introducing me to the TRACE tool.
> >
> >                                         Regards...
> >                                         [[Yehuda]]
> 
> Yes indeed TRACE is very powerful. Most MswLogo users know about TRACE
> because I felt it was a critical feature as well, so I decicated a
> button
> to it in the commander window (kids love to push buttons I'm sure most
> have pushed it :-)). The button works slightly different in
> that allows you to turn it on or off while your program is running.
> It basically does a TRACE ALL when it's on. It's very handy to see
> what your program is up to at any time. It does not interfere with
> the "normal" TRACE "procedure command.
> 
> Note that Trace only shows Entering and Leaving a procedure. There
> is also STEP "procedure which shows each line executing within that
> procedure.
> 
> PAUSE can also be used to help debug code by placing a condition
> on it and PAUSEing your code exactly where you want it so
> you can examine its state.
> 
> Actually you can place conditions on any of these commands to
> enable them and disable them to help prune down the amount of
> data which can get huge rather quickly.
> 
> Ex:
> 
> to sq :size
> repeat 4 [fd :size rt 90]
> end
> 
> to twirl
> repeat 72 ~
>    [
>    if repcount = 10 [trace "sq]
>    if repcount = 15 [untrace "sq]
>    sq repcount
>    rt 5
>    ]
> end
> 
> twirl
> ( sq 10 )
> sq stops
> ( sq 11 )
> sq stops
> ( sq 12 )
> sq stops
> ( sq 13 )
> sq stops
> ( sq 14 )
> sq stops 

Hi George,
Your example is really impressive and a very effective use of TRACE!

					Regards...
					[[Yehuda]]
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.

