I'm writing this function on SML. It is supposed to take a list of possible first name variations (my name is Victoria, so V, Vic, Vicky, etc.) and create records of {altname1, middle, last}, {alt2, middle, last}.
So here's my code:
fun similar_names (substits:, name) =
let
val {first=n1, second=n2, third=n3} = name
fun name_constructor (altnames:string list, acc) =
case altnames of
[] => acc
| a::aa => {first=a, second=n2, third=n3}::acc
in
name_constructor( get_substitutions2(substits, n1),name)
end
get_substitutions2 will just give a list of all the possible variations of a first name (ie: string list), and it works.
The error I'm getting is:
a02.sml:65.2-65.58 Error: operator and operand don't agree [tycon mismatch]
operator domain: string list * {first:string, second:'Z, third:'Y} list
operand: string list * {first:string, second:'Z, third:'Y}
in expression:
name_constructor (get_substitutions2 (substits,n1),name)
I don't understand why it's going between record list and record alone. Could you help?