tags:

views:

89

answers:

1

Two people considered identical if they have exactly the same information (same name, sex, birth and death).

I must declare a function pers: person * person -> bool that determines whether two values of type person enter the same person.

I'm stucked, anyone ? tnx.

+1  A: 

Alright, I know your assignment and this is what I've done:

datatype person = Person of navn * koen * aarstal * aarstal

fun pers (Person(a,b,c,d) , Person (e,f,g,h) = if (a,b,c,d) = (e,f,g,h) 
then true else false;

Basically, I take the name, sex, year of birth and death and check them against each other. If everything is the same it returns true, if not false (navn, koen and aarstal are all previously defined datatypes).

If anyone has a smarter solution to this, please let me know!

GeorgeWChubby
I have also made it like that almost.. just simpler..: fun pers (Person x1, Person x2 = x1 = x2 It's sml, so I havn't used true or false...what have you done in the next onefjern : aneTrae * foraelder list -> aneTrae ???
peter81
My function returns val pers = fn : person * person -> bool, so I think I've done it correctly. I guess there's more than one way of doing this. What have you done for the next one? I'm stuck on it right now.
GeorgeWChubby
I'm aloso stucked, have no clue.. but I'm looking at it..something like this: ?? no fun fjern (anetrae x, foraeldre list y) = y - x | fjern (t, p
peter81
Have you any idea???!...
peter81
Nope :( I'm completely stuck, but I think my foraeldre might be wrong. I'm not sure if we did it correctly for the group assignment.
GeorgeWChubby