These are chat archives for ramda/ramda

14th
Dec 2015
Xananax
@Xananax
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: https://github.com/princejwesley/Mancy
It's an electron-based REPL, sorta like using chrome's console
Scott Christopher
@scott-christopher
Dec 14 2015 00:02
Cool, I'll be sure to check it out.
Hardy Jones
@joneshf
Dec 14 2015 02:11
@CrossEye I'm not sure. Seems like it should be. You should prove or disprove though. :)
Scott Sauyet
@CrossEye
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
@jgoux
Dec 14 2015 14:03
Hello
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(R.map(R.prop("id"))(resultats), acc)
                )([])(dossiers), acc)
            )([])(patients)
not really friendly
xD
Kibin
@kibin
Dec 14 2015 14:14
@jgoux how does your data structure look?
And what do you want your result to look like?
Julien Goux
@jgoux
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
Kibin
@kibin
Dec 14 2015 16:24
Based on @jgoux function I think that something that he needs is http://bit.ly/1YanzGR
Kibin
@kibin
Dec 14 2015 16:45
@jgoux here’s your accumulatePath: http://bit.ly/1YaqpM0