[plt-scheme] Re: Htdp chapter 12 insertion sort

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Tue Jun 2 17:43:41 EDT 2009

One advantage to making the questions as clear as possible is that you
get error messages earlier.

  [(empty? alon) ....]
  [(cons? alon) ....]

gives an "all question results were false" error if you pass in
something like 4, "boo", or 'a. In contrast,

  [(empty? alon) ...]
  [else ...]

goes into the default answer and gives you some kind of error because
you called a function like first or rest on something that's not a

It seems to be a sound principle that, if you're going to fail, it's a
good idea to do it as soon as possible. :-)


On Tue, Jun 2, 2009 at 4:02 PM, Marco Morazan <morazanm at gmail.com> wrote:
> On Tue, Jun 2, 2009 at 3:40 PM, aditya shukla
> <adityashukla1983 at gmail.com> wrote:
>> I thought there should be else in place of cons? and what's the use of cons?
>> here.
> OK, that makes it clear. So as I said in my reply you can rewrite the
> function using else. It is two ways of doing exactly the same thing.
> :-)
> --
> Cheers,
> Marco
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.