mapo multimethod

Methods

mapo(e:Eachable1, mapper:Fun)experimental Source: stdlib.ngs:290
EXPERIMENTAL! Do not use! Map e to same type. Mnemonics: "map original" / "MAP to Original type".

Parameters

eobject of any type that has each(e, callback) implemented Eachable1. WARNING: instances of same type as e must have empty constructor and push() method.

Returns

Of same type as e

Example

Set([1,2]).mapo(X*2)  # Set([2,4])
mapo(s:Str, mapper:Fun) Source: stdlib.ngs:3622
Map a string, character by character.

Returns

Str

Example

"abcd".mapo(F(x) if x == "b" then "X" else x)  # "aXcd"