Feedback User-defined cond is flawed, factoring application fixes flaw 

Forum: U Chicago, Com Sci 221, autumn 2000
Re: News Final exam Monday 4 December (Mike O'Donnell)
Re: None ML Pattern Matching Review (Oliver Rothschild)
Re: Question question: why cond definition is not satisfactory (Maggie Novak)
Date: 2000, Dec 03
From: Mike O'Donnell <odonnell@cs.uchicago.edu>

I don't understand the question precisely. The user-defined cond is flawed, in the sense that it fails to accomplish something that the built-in if accomplishes. The problem has to do with order of evaluation. In some cases, cond is used in the form cond c (x z) (y z), and the flaw occurs. In some of those cases, the flaw can be avoided by rewriting into the form cond c x y z. There are other ways of fixing other cases, but this one is the easiest to grasp.

To put it another way, for certain x, y, z, the user defined cond (x z) (y z) behaves worse than the corresponding use of the built-in conditional, if c then (x z) else (y z), but cond x y z behaves essentially the same as if c then (x z) else (y z).



Mike O'D.


to: "User-defined cond is flawed, factoring application fixes flaw"