Suppose Event is record with fields like eventName and eventParameter. I want to assert for the condition if some eventName say "EV1" is present in list of records. For list of native Data types (let say Parties) I can simply check with (elem in following) as given in docs. Can anyone help me what would be the syntax for record data type?
How do I check if an element is present in list of records in DAML?
328 views Asked by Prachi Gupta At
1
elemis an instance of a more general functionany : (a -> Bool) -> [a] -> Boolwhich takes a predicate and a list of elements and returns true if the predicate holds for at least one element in the list.elem x xsis equivalent toany (\y -> x == y) xs.Using
anyyou can express your example as follows: