Skip to content

Instantly share code, notes, and snippets.

@luijar
Created September 26, 2015 21:56
Show Gist options
  • Save luijar/8eea50d13e7d41864a69 to your computer and use it in GitHub Desktop.
Save luijar/8eea50d13e7d41864a69 to your computer and use it in GitHub Desktop.
Avoid side effect with lenses
var headLens = R.lensIndex(0); // point to first element in the array
R.view(headLens, people); //=> ana
var array2 = R.set(headLens, 'OLIVIA', firstnames); //=> ["OLIVIA", "LUIS", "CARLOS", "NESTOR", "MARIA"]
R.over(headLens, R.toLower, array2); //=> ["olivia", "LUIS", "CARLOS", "NESTOR", "MARIA"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment