when multimethod
Methods
- when(val:Any, pat:Any, new_val:Any) Source: stdlib.ngs:1488
If val matches pat, return new_val.Value(val); otherwise return val. Use instead of older only() Example
"abcd".mapo(X.when("b", "*")) # a*cd "abcd".mapo(F(x) x.when("b", "[$X]")) # a[b]cd