k***t 发帖数: 769 | 1 Write a function increasing: int list -> bool that returns true if its
input is a list of integers in increasing order.
刚开始学习编程,这个不会。求助! |
l***i 发帖数: 6 | 2 fun increasing [] = true |
increasing (h::t) = if h<= hd(t) then increasing(t)
else false;
不知对不对?
|
k***t 发帖数: 769 | 3 Write a function increasing: int list -> bool that returns true if its
input is a list of integers in increasing order.
刚开始学习编程,这个不会。求助! |
l***i 发帖数: 6 | 4 fun increasing [] = true |
increasing (h::t) = if h<= hd(t) then increasing(t)
else false;
不知对不对?
|
s****e 发帖数: 1 | 5 fun increasing lst =
case lst of
[] => false
| x::y::[] => (x
| x::xs => case increasing(xs) of
true => x
| false => false
我只测了最简单的一组升序 |