I'm trying to declare a function that will let me change a number in a char list list (I'm still working on the sudoku game from earlier). changesudo : char list list -> int * int * char -> char list list I need to be able to call changesudo xs (r,s,c) where xs is the char list list, r is the list, s is the position in xs and c is the char.
This is what I have:
fun changesudo xs (r,s,c) =
let
val g = hd (List.take (List.drop
(xs , (r-1)) , 1));
val h = (List.take(g , s-1)) @ [c]
@ List.drop(g , s);
in
(List.take (xs , (r-1)) @ [h] @ List.drop(xs , r))
end;
and this is a 'a list list -> int * int * 'a -> 'a list list - so I'm almost there.
How do I fix it?
I get the char list list with this function