The signature of foldl in SML/NJ 110.75 is
foldl;
val it = fn : ('a * 'b -> 'b) -> 'b -> 'a list -> 'b
Also if I give:
foldl (op -) 2 [1];
I will take as answer ~1 instead of 1
Can you confirm my findings?
The signature of foldl in SML/NJ 110.75 is
foldl;
val it = fn : ('a * 'b -> 'b) -> 'b -> 'a list -> 'b
Also if I give:
foldl (op -) 2 [1];
I will take as answer ~1 instead of 1
Can you confirm my findings?
From the basis library: http://www.standardml.org/Basis/list.html#SIG:LIST.foldl:VAL
thus in
foldl (op -) 2 [1]the result is the evaluation ofxn - initor1 - 2What makes this particular example a bit harder to understand is that
(op -)is a non-associative infix operator. So thefin the basis library definition gets moved betweenxnandinit.The signature is only for static type checking, and it is worth remembering that
'aand'bmay be of the same type.