only multimethod

Methods

only(pattern:Any, mapper:Fun)deprecated Source: stdlib.ngs:1466
Deprecated. Use when(val, pat, new_val) instead. Transform mapper to handle only items matching pattern. Non-matching items will be returned as is.

Example

["abc", 1, "def", 2].map(only(Int, X*2))  # ["abc", 2, "def", 4]
only(val:Any, pattern:Any, mapper:Fun)deprecated Source: stdlib.ngs:1476
Same as val.when(pattern, mapper)