These are chat archives for ramda/ramda

Dec 2015
Dec 14 2015 00:01
I don't know if you know the project, I used to consider it as a bit of a stupid thing but I find myself using it sometimes:
It's an electron-based REPL, sorta like using chrome's console
Scott Christopher
Dec 14 2015 00:02
Cool, I'll be sure to check it out.
Hardy Jones
Dec 14 2015 02:11
@CrossEye I'm not sure. Seems like it should be. You should prove or disprove though. :)
Scott Sauyet
Dec 14 2015 02:25
But my point on Either.Lefts is that since they choose a value rather than combining them, mAdd(Left(val1), Left(val2)) ≢ mAdd(Left(val2), Left(val1)), which seems to automatically imply that lift doesn't preserve commutativity. But maybe I'm smoking something funny. I'm overseas, and perhaps the 10.5-hour time difference is messing with my head.
Julien Goux
Dec 14 2015 14:03
I want to collect nested values inside a flat array (2 levels deep), is there a better solution than reduce + concat ?
const resultatsIds = R.reduce((acc, { dossiers }) =>
                R.concat(R.reduce((acc, { resultats }) =>
                    R.concat("id"))(resultats), acc)
                )([])(dossiers), acc)
not really friendly
Dec 14 2015 14:14
@jgoux how does your data structure look?
And what do you want your result to look like?
Julien Goux
Dec 14 2015 14:17
@kibin It's basically collections of collections of collections of objects :p And I need to accumulate a value from the deepest collection in each of the root collection
patients -> dossiers -> resultats -> id
for each patients -> for each dossiers -> for each resultats -> get resultat's id
then at the end I have a flat array or resultats ids
the code I pasted works, but maybe there is a better way
accumulatePath(["dossiers", "resultats", "id"])(patients) something like this would be great, I'll try to make my own helper
sorry for the long url
Dec 14 2015 16:24
Based on @jgoux function I think that something that he needs is
Dec 14 2015 16:45
@jgoux here’s your accumulatePath: