Next: , Previous: , Up: Top  


11 Knit Functions

These functions modify lists and dictionaries given a list of indices and functions or values to replace.

@[x;i;f[;y]] amend
.[x;i;f[;y]] dmend

11.1 amend ⇒ @[x;i;f[;y]]

Replace the values in list/dictionary x at indices i with f or f[y].

@[x;i;f] and @[x;i;f;y] examples

 x:(1 2;3 4;5 6);x
1 2
3 4
5 6

 @[x;2 0;0]
0  
3 4
0  

 x:(1 2;3 4;5 6);x
1 2
3 4
5 6

 @[x;2 0;+;100]
101 102
  3   4
105 106

11.2 dmend ⇒ .[x;i;f[;y]]

Replace the values in list/dictionary x at index i with f or f[y].

.[x;i;f] and .[x;i;f;y] examples

 x:(1 2;3 4;5 6);x
1 2
3 4
5 6

 .[x;2 0;0]
1 2
3 4
0 6

 
 x:(1 2;3 4;5 6);x
1 2
3 4
5 6

 .[x;2 0;+;100]
  1 2
  3 4
105 6