ML

Stephen Weeks sweeks@intertrust.com
Thu, 28 Sep 2000 09:14:40 -0700 (PDT)


> Hi,
> I'm currently programming in ML, but woul need some help now. I try to
> construct a function makeing an ascending list out of a list. I have this so
> far, but something is wrong with it:
> 
> load "Int";
> exception empty;
> 
> fun ascend []= raise empty
> | ascend (x1::x2::xs) = Int.min(x1,x2)::(tl(ascend xs));
> 
> Can u help me with it? Thanks in advance: Gabor

The right place to send general questions about ML is to the comp.lang.ml
newsgroup.  MLton@sourcelight.com is for questions specific to the SML compiler
MLton.  

One problem with your ascend function is that the list it returns will always
start with either the first or second element of its input list.  You probably
want the list it returns to start with the smallest element of the input list,
no matter where that element may be.  Good luck.