These are chat archives for ramda/ramda

2nd
Mar 2018
sourcevault
@sourcevault
Mar 02 2018 09:01
does Ramda ship with individual imports ? ( as in just one function ) for node.js
Simon Friis Vindum
@paldepind
Mar 02 2018 10:13
@sourcevault You can do require("ramda/src/foo"). As far as I'm aware it's not really "official" but a lot of people do it and I think we're committed to keeping it working (for instance the change to ES modules internally was done deliberately so that Node modules was still to be found in src/.
sourcevault
@sourcevault
Mar 02 2018 10:28
alright - good work with list - are you planning on adding POJO support ?
Alec
@alavkx
Mar 02 2018 15:51
@jay-jlm don't feel bad, @Bradcomp is pretty good :laughing:
Brad Compton (he/him)
@Bradcomp
Mar 02 2018 16:17
:bowtie:
sitty
@sitty
Mar 02 2018 16:48
i have string key=value input which i need to split and then pass the key to fn1 and value to fn2 is there some way to achieve this using ramda ?
Brad Compton (he/him)
@Bradcomp
Mar 02 2018 17:03
@sitty Do you mean like a query string? k1=v1&k2=v2&... ?
sitty
@sitty
Mar 02 2018 17:25
@Bradcomp yea sort of like that
Brad Compton (he/him)
@Bradcomp
Mar 02 2018 17:49
pipe(
  split('&'),             //split into an array of each item
  map(split('=')), //split each item into key and value
  map(([k, v]) => {  //do what you want with the key and value })
)

useWith might also be helpful once you split up the key and value...

useWith(joiningFn, [keyFn, valFn])(k, v)

Robert Mennell
@skatcat31
Mar 02 2018 17:57
either that or map with converge map(converge(joiningFunction, [head(takesKey), tail(takesvalue)]))
but it's oddily verbose...
Robert Mennell
@skatcat31
Mar 02 2018 18:08
R.useWith
Robert Mennell
@skatcat31
Mar 02 2018 18:09
it's been so long since I've been here ram-bot was broken the last time I was...
sitty
@sitty
Mar 02 2018 18:53
That's not quite what I want what I want is something like this
someFn([f1, f2], [v1,v2]) ->[f1(v1) ,f2[v2]]
sourcevault
@sourcevault
Mar 02 2018 19:05
you guys win this time - was hoping transducer specific lib would perform better :worried:
https://github.com/sourcevault/transducer-benchmark
Matthew Willhite
@miwillhite
Mar 02 2018 20:11
@sitty
map(([f,v]) => f(v), zip([toUpper, toLower], ['Foo', 'Bar']))
//=> [‘FOO’, ‘bar’]
There is probably something more elegant to replace ([f,v]) => f(v)
Mike Lambert
@lax4mike
Mar 02 2018 20:12
maybe you can use http://ramdajs.com/docs/#juxt
Matthew Willhite
@miwillhite
Mar 02 2018 20:12
zipWith(call, [toUpper, toLower], ['Foo', 'Bar’])
That’ll do it…
Mike Lambert
@lax4mike
Mar 02 2018 20:13
you might also need R.apply
oh, or that :smile:
Barry G
@bgits
Mar 02 2018 21:23
Is there a function that can nest a list in ramda? ie: R.nest(2, [1, 2, 3, 4, 5]); //=> [[1,2],[3,4],[5]]
Mike Lambert
@lax4mike
Mar 02 2018 21:24
R.splitEvery
functionalStoic
@functionalStoic
Mar 02 2018 21:25
Barry G
@bgits
Mar 02 2018 21:26
awesome