These are chat archives for ramda/ramda

Jan 2019
Pranab Gupta
Jan 15 14:39
Hi everyone! what is the difference between R.lensPath and R.path? As per docs, R.lensPath returns lens.
Riku Tiira
Jan 15 15:07
R.lensPath is meant to be used with lens functions such as R.over and R.set
Pranab Gupta
Jan 15 15:27
Thanks @rikutiira for your response. Whats the advantage of lens function over normal function?
Rakesh Pai
Jan 15 15:30
@Pranab16 I'll try explaining. A lens consists of two things: a getter and a setter. So, when you create a lens using lensProp, you've created a way to both read and set the value in an object. You can set the value using set, you can read it using get, and you can do a map-like transformation using over.
Brad Compton (he/him)
Jan 15 16:08

If you just need to get a value that exists in an object then path is probably a more straightforward choice. Lenses add a layer of indirection that allow us to perform additional operations as well as abstract over them.

They are pretty much just a representation of a getter and a setter for a part of an object or value, wile path is simply a getter for a nested value.