<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Um ... To the other people giving
hints: Don't forget that in the sequence *of lines in the
program* you have to state the base case(s) *first*, certainly in
Haskell, which goes through the lines in order, until it finds a
match.<br>
<br>
That's what I meant when I said "first do the base case(s), then
the rest": first *in the program order*, if not necessarily in
the conceptual structure. So for the depth-first binary tree
which Joel Neely pointed out, *first* you must deal with the base
case that the node being looked at is actually a leaf; *only then*
can you deal with the fact that in general the algorithm has the
structure <process left descendants><process this
node><process right descendants>.<br>
<br>
So if you try <move stack off of bottom><move
bottom><place stack on bottom>, the first part will
either enter an endless loop or will generate an error, because it
doesn't have a base case. (No pun on "base" intended.)<br>
<br>
On 2/17/15 4:05 AM, Joel Neely wrote:<br>
</div>
<blockquote
cite="mid:CAEEzXAifYjbjBhPB=nk-hmNvrzf-cSSVrXQeC6shBnA7Z9=EGA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small">Let's
tweak your answers just a bit, calling the three pegs the
"source", "goal", and "spare" pegs:</div>
<br>
<div class="gmail_quote">On Tue, Feb 17, 2015 at 5:23 AM,
Roelof Wobben <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">- Where do I move
the bottom (largest disk) ? <br>
<br>
To the last peg, which do not contain any disk then
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small;display:inline">
.</div>
</div>
</blockquote>
<div><br>
</div>
<div>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small;display:inline">From
the source peg to the goal peg, which will</div>
<span style="font-family:georgia,serif">/must</span>
<div class="gmail_default"
style="font-family:georgia,serif;display:inline"> not
contain any disks.</div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small;display:inline"></div>
<br>
<br>
- What must happen before I can move the bottom disk ? <br>
<br>
I have to move the disk which above that disk. <br>
</div>
</blockquote>
<div><br>
</div>
<div>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small;display:inline">Move
everything else from ____ to ____.</div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <br>
- What must happen after I move the bottom disk ?<br>
<br>
All the other disk must be placed above that disk. <br>
</div>
</blockquote>
<div><br>
</div>
<div>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small;display:inline">
Move everything else from ____ to ____.</div>
</div>
</div>
<br>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small">So more
questions/hints:</div>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small">
<ol>
<li>How do you fill in the blanks?<br>
</li>
<li>How do you put the three statements in order?<br>
</li>
<li>How many disks does each statement talk about?<br>
</li>
</ol>
</div>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small"><br>
</div>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small">-jn-</div>
<div class="gmail_default"
style="font-family:georgia,serif;font-size:small"></div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">Beauty of style and harmony and
grace and good rhythm depend on simplicity. - Plato</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>