From lliao@ren.eecis.udel.edu Mon Oct 28 22:56:52 2002 Date: Mon, 28 Oct 2002 22:55:23 -0500 (EST) From: Li Liao Subject: Re: hw3 sample solution On Mon, 28 Oct 2002, Greg Forte wrote: > On Mon, 28 Oct 2002, Li Liao wrote: > > > Attached please find the sample solution to homework 3. > > It may be helpful for you to prepare for tomorrow's midterm. > > Good luck. See you tomorrow. > > I think there's a problem with the solution to problem 2. As I > understand it (and as shown in Harper's "Programming in Standard ML"), > the expression "_exp1_ andalso _exp2_" is shorthand for as one way of implementing short-circuit evaluation > "if _exp1_ then _exp2_ else false", which would mean that the > two functions presented in the solution are in fact identical ... Syntactically, without short-circuit effect, the sample solution should be fine. But you certainly made a very good point here. Your solution below is better, for which you should earn extra credits. Thanks for your comments. Li > > If my solution was correct, the non-tail-recursive version should > have the arguments reversed, i.e. > > isord (t2::ts) andalso (t1 <= t2) > > Is that correct? > > -g > > >