assp


assp(predic, xys, @key default = false)
      

Call the predicate predic with the head of each pair in the association list xys. Return the pair for which predic returns true. If no pair satisfied predic, return the value of default.

Examples:


assp(is_odd, [2:200, 3:300])
// 3:300

assp(is_even, [2:200, 3:300])
// 2:200

assp(is_even, [1:200, 3:300])
// false

assp(is_even, [1:200, 3:300], default = 2)
// 2
      

Also see:

assoc
assv
assq


Core Module Index | Contents