Recipes by Ingredients
type recipe = { name : string; ingrs : string list; }
Implement the function
val recs_by_ingrs : recipe list -> string list -> recipe list
so that recs_by_ingrs recs ingrs is the list of those recipes in
recs (in the same order) whose ingredients are included in
ingrs. You may assume that ingrs and r.ingrs for every r in
recs do not contain duplicates.
Examples
let r1 = { name = "1" ; ingrs = ["a"; "b"; "d"] } let r2 = { name = "2" ; ingrs = ["a"; "c"; "e"] } let r3 = { name = "3" ; ingrs = ["b"; "c"] } let _ = assert (recs_by_ingrs [r1; r2; r3] ["a"; "b"; "c"; "d"] = [r1; r3]) let _ = assert (recs_by_ingrs [r1; r2; r3] ["a"; "b"; "c"; "e"] = [r2; r3])