Vyxapedia

Element - V - Replace / Map to Indices

Characters: V


Description

Replace b with c in a / Map a function at elements of a list whose indices are in another list


Overloads

  • any-any-any - a.replace(b,c) (replace). b can be a list of substrings to replace. If b is a list of substrings, so can c. If c is shorter, the extra strings in b will be replaced with the empty string, i.e., removed.
  • lst-lst-fun - for each i in b, change the ith element in a by applying the function, then return the new list
  • lst-num-fun - replace the bth element in a by applying the function, then return the new list

Examples

  • `hela` `a` `lo` V = `hello`
  • `banana` `n` `nan` V = `banananana`
  • ⟨2|3|4⟩ 2 4 V = ⟨4|3|4⟩
  • 234 2 4 V = 434
  • 234 2 `4` V = `434`
  • 234 `2` 4 V = 434
  • `234` 2 4 V = `434`
  • `234` `2` 4 V = `434`
  • `abcdefabdee` ⟨`abc`|`ab`|`e`|`d`⟩ ⟨1|2|3|`ab`⟩ V = `1ab3f2ab33`
  • `alice,bobabcfred` ⟨`lice`|`bob`|`red`⟩ `123` V = `a123,123abcf123`
  • `abcdef` ⟨`a`|`b`|`c`|`d`⟩ ⟨`1`⟩ V = `1ef`