thinking in ramda 7

Reading Array Elements

Ramda functions for reading array elements nth and slice and contains

1
2
3
4
5
const numbers = [10,20,30,40,50,60]
(3, numbers)
(-2, numbers) // =>50 (negative numbers start from the right)
slice(2, 5, numbers) // => [30,40, 50] (see below)
contains(20, numbers) // => true

nth(0) equals head, nth(-1) equals last.

It also provides functions for accesing all-but-the-first element tail,all-but-the-last element init,the first N elements take(N), and the last N elments takeLast(N).

Adding, Updating, and Removing Array Elements

  • insert
  • update
  • append
  • prepend
  • update
  • concat
  • concatAfter = flip(concat)

Transforming Elements

  • update
  • adjust
  • evolve

Cite From « Thinking in Ramda: Immutability and Arrays »