These are chat archives for ramda/ramda

15th
Jun 2018
Eugene Krayni
@eakray
Jun 15 2018 05:38
are reduce and fold synonymous?
and is a traversal an iteratable data structure?
Vesa Karvonen
@polytypic
Jun 15 2018 05:40
"Reduce" and "fold" are often used to refer to similar things, so yes.
A traversal is not a data structure. Traversals are a kind of functions. These might help to understand them: Partial Lenses Implementation and Traversals in depth.
Vesa Karvonen
@polytypic
Jun 15 2018 05:50

nice. I was sort of hoping to not add dependencies if I could get away with it but thanks for that link.

BTW, note that both Partial Lenses and Ramda are modern functional JS libraries in the sense that they support dead code elimination when used via a modern bundler (e.g. Rollup and Webpack (v4 or earlier with module concatenation)) and minifier (e.g. UglifyJS).

Vilius Vaivada
@seminolas
Jun 15 2018 13:15
hi everyone, ramda noob here. how would something like this look in ramda? objects.filter((o) => !o.foo || o.foo === 'bar')
in my head it looks a bit like R.filter(R.anyPass([R.isNil, R.equals('bar')])(R.prop('foo')), objects) but that doesn't quite work...
Sergiu Ghenciu
@1024gs
Jun 15 2018 14:35
@seminolas
const filterNotOrBar = filter(pipe(prop('foo'), either(not, identical('bar'))))
const result  = filterNotOrBar(objects);
Vilius Vaivada
@seminolas
Jun 15 2018 15:52
thanks @1024gs !