I have a record type that goes,
type person = {
name: string,
gender: string,
age: int
}
and have lots of records that fit with the type. What I want to do is to extract only [name, age] from the person and make a new record. To do so, I initially thought of using a pattern-matching technique that goes like,
switch(input) {
|({name, _, gender} => //make a new record by extracting only name and age
|_ => ();
}
Does this approach make sense? If so, how should I go about it? If not, what would be the proper way of deleting a key from a record(records are immutable, so this doesn't really make sense), or extracting another record from an existing one?