These are chat archives for ramda/ramda

5th
Mar 2018
基尔霍夫
@weiqingting
Mar 05 2018 06:36
。。
Diego Segura
@dieguezz
Mar 05 2018 10:40
hi, whats going on with ramda docs? page does not load since a week or more
Francisco
@franciscotln
Mar 05 2018 12:51
this one opens for me: http://ramdajs.com/docs/
Gant Laborde
@GantMan
Mar 05 2018 13:26
Any way to do this in a witty manner?
https://goo.gl/qZuG5n
maybe reduce was lazy?
Diego Segura
@dieguezz
Mar 05 2018 13:47
@franciscotln i think its my office, thanks
the version is 0.24.1 but still better than nothing :D
Shawn Talbert
@ShawnTalbert
Mar 05 2018 17:44
hi folks. Does ramda let you define a custom sequence? i.e. perhaps passing something that is iterable but not an array or object?
I saw someone say it is abstracting a bit via things like filterable so was wondering if it's abstracted away from requiring my input data to be arrays
Shawn Talbert
@ShawnTalbert
Mar 05 2018 18:00
or put another way, can I use a js generator or iterable as the data input to Ramda?
Caleb Whiting
@whmountains
Mar 05 2018 18:02
Does Ramda have a recommended way to convert an object to an array of values?
It's available natively in Javascript
Mike Lambert
@lax4mike
Mar 05 2018 18:03
R.values too
be careful with native functions, Object.values does not work in IE, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values
joao@kapmug
@jay-jlm
Mar 05 2018 18:06
say I have an array of arrays. how can I get an array of just the first value of each one?
Mike Lambert
@lax4mike
Mar 05 2018 18:06
R.map(R.nth(0)) might do it
joao@kapmug
@jay-jlm
Mar 05 2018 18:06
nice, thanks
Mike Lambert
@lax4mike
Mar 05 2018 18:08
@ShawnTalbert what does your data structure look like? I imagine if it's iterable most ramda function will work
joao@kapmug
@jay-jlm
Mar 05 2018 18:08
did not work
Mike Lambert
@lax4mike
Mar 05 2018 18:08
i'm curious to see though...
joao@kapmug
@jay-jlm
Mar 05 2018 18:08
const knownTypes = R.map(R.nth(0))(typeMaps)
Cannot read property '0' of undefined
Mike Lambert
@lax4mike
Mar 05 2018 18:09
what does typeMaps look like?
joao@kapmug
@jay-jlm
Mar 05 2018 18:10
this also does not work const knownTypes = R.map(R.nth(0), typeMaps)
an array of arrays
Mike Lambert
@lax4mike
Mar 05 2018 18:10
you sure?
joao@kapmug
@jay-jlm
Mar 05 2018 18:10
and all elements have 2 elements
Mike Lambert
@lax4mike
Mar 05 2018 18:10
joao@kapmug
@jay-jlm
Mar 05 2018 18:12
hmmm had a typo in my array and the REPL did not bother with it, that was the reason
thanks mate!
Mike Lambert
@lax4mike
Mar 05 2018 18:13
:thumbsup:
Francisco
@franciscotln
Mar 05 2018 18:19
@jay-jlm R.map(R.head)
Shawn Talbert
@ShawnTalbert
Mar 05 2018 19:02
@lax4mike I'm looking to (lazily) surface search results from a backend and process them sequentially. I can make the results look like a js iterator/iterable
but ramda doesn't seem to like if I pass a function/iterable as the data to a simple operation like forEach()
lodash doesn't support this either
but lazyjs does, though that library isn't as popular/maintained
Shawn Talbert
@ShawnTalbert
Mar 05 2018 21:45
looking at the docs for .filter() it says it takes a Filterable without defining what a "filterable" is. Anyone know where filterable is explicitly documented?
Mike Lambert
@lax4mike
Mar 05 2018 21:45
you might be able to run it through Array.from first
joao@kapmug
@jay-jlm
Mar 05 2018 23:37
@ShawnTalbert , if I had to guess what a filterable is by looking at the source code I'd say it~s anything that is an object and has a .length property... but hey don't quote me on it ;-)