These are chat archives for ramda/ramda

17th
Feb 2018
Kurt Milam
@kurtmilam
Feb 17 2018 01:00
@SeeThruHead Here it is with partial.lenses, although it's possible there's a shorter solution with that library.
The partial.lenses solution:
``````L.collect([
'results',
L.elems, 'lexicalEntries',
L.elems, 'entries',
L.elems, 'senses',
L.elems, 'synonyms',
L.elems, 'id'
], res)``````
Andy
@andys8
Feb 17 2018 01:05
@hbrade Thanks, I didn't expect a different repository.
Kurt Milam
@kurtmilam
Feb 17 2018 01:07
You could also do something like:
``````const gather = R.chain(x => [L.elems, x])
L.collect(['results', gather(['lexicalEntries', 'entries', 'senses', 'synonyms', 'id'])], res)``````
Kurt Milam
@kurtmilam
Feb 17 2018 01:22
Probably makes more sense like this:
``````const path = ['results', 'lexicalEntries', 'entries', 'senses', 'synonyms']
const gather = R.chain(x => [x, L.elems])
L.collect([gather(path), 'id'], res)``````
Vesa Karvonen
@polytypic
Feb 17 2018 10:18
If you are looking for a concise solution, then using the new `L.query` combinator of Partial Lenses one can just say `L.query('synonyms', 'id')`.
Kurt Milam
@kurtmilam
Feb 17 2018 13:22
This REPL shows two working examples (using `L.flat` and `L.query`).
The code:
``````const path = ['results', 'lexicalEntries', 'entries', 'senses', 'synonyms', 'id']
const flat = L.collect(L.flat(...path), res)
// or, trading performance for concision:
const query = L.collect(L.query('synonyms', 'id'), res)``````
Jason Shin
@JasonShin
Feb 17 2018 13:59
ahhhh
I found why no errors were thrown in my Ramda + Fluture based app
it's based Fluture swallows all the errors...
....
Kurt Milam
@kurtmilam
Feb 17 2018 14:28
@avaq - might be something you want to respond to?
@JasonShin I think it's incorrect to say that Fluture swallows errors based on the text at your link.