my permutation function:
fun perms [] = [[]] | perms (x::xs) = let fun insertEverywhere [] = [[x]] | insertEverywhere (y::ys) = let fun consY list = y::list in (x::y::ys) :: (map consY (insertEverywhere ys)) end in List.concat (map insertEverywhere (perms xs)) end;
input:
perms [];
output:
stdIn:813.1-813.9 Warning: type vars not generalized because of
value restriction are instantiated to dummy types (X1,X2,...)
val it = [[]] : ?.X1 list list
Can someone explain why the type vars aren't generalized?
I should note, the type of perms is given after inputting perms; as
perms;
val it = fn : 'a list -> 'a list list
So it looks like I have achieved generalized variables, to me at least.