While learning the SML, I came up with the following question. Look at this example:
fun check (elem,myList) =
let
fun check1 elem [] = fn (x,_,_) => elem > x
fun check2 elem [] = fn (_,y,_) => elem < y
in
if check1 andalso check2 then 1 else 0
end
The probem is that IF THEN rule does not work here. Why? As far as I understand check1 and check2 should return BOOL value, which allows using IF THEN. I tried to declare local variables, but this didn´t help to solve the problem.
check1
and check2
are functions, not bool
values. Presumably, you'll want to apply them to something?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.