These are chat archives for ramda/ramda

9th
Jun 2015
John-David Dalton
@jdalton
Jun 09 2015 00:08
@buzzdecafe I tackled the issue by allowing devs to use ES Map/WeakMap (or there shims) as the backing . More solid than attempting to serialize values.
Scott Sauyet
@CrossEye
Jun 09 2015 00:38
@raine: That was a nice article. Thanks.
Scott Sauyet
@CrossEye
Jun 09 2015 00:43
@jdalton: I can see Map, but how do you use WeakMap for this? Do you switch based on the types of keys supplied, since WeakMaps only allow Object keys?
James Forbes
@JAForbes
Jun 09 2015 01:47
@vikfroberg That video was great! Thank you
John-David Dalton
@jdalton
Jun 09 2015 02:45
@CrossEye Since the backing can be customized it's up to the user.
Scott Sauyet
@CrossEye
Jun 09 2015 02:54
@jdalton: _.memoize.Cache = WeakMap; Does this just affect the next memoize call? Or is there some way to set this back to the default?
John-David Dalton
@jdalton
Jun 09 2015 04:43
It's the cache constructor so memoize calls after that will use it.
Hardi Kõvamees
@luminarious
Jun 09 2015 05:21
Hey! I'm trying to familiarize myself with Ramda-isms but I got my first question. In the middle of a compose sequence, what's the right way to R.times(R.take(100), 10) in the middle of a compose? I'm just trying to divide an array of 1000 items into chuncks of 100.
Scott Christopher
@scott-christopher
Jun 09 2015 05:23
@luminarious: R.aperture(100) might be what you’re after
Actually, ignore that :)
Hardi Kõvamees
@luminarious
Jun 09 2015 05:27
Yup, I was disappointed by that one already.. :P
Hardi Kõvamees
@luminarious
Jun 09 2015 05:46
I tried R.into([], R.slice(0,100)) as well, but that errored as well.
Kevin Wallace
@kedashoe
Jun 09 2015 05:57
Looks like it is in the works #1050 but no activity for a while
feel free to chime in on that PR if it looks like what you want :smile:
Scott Christopher
@scott-christopher
Jun 09 2015 06:26
You could define it recursively with something like:
function chunk(n, list) {
  return R.isEmpty(list) ? [] : R.prepend(R.take(n, list), chunk(n, R.drop(n, list)));
}
but it's probably not as speedy as the imperative implementations if that’s important to you
and you’ll need to be careful with large lists/small chunk sizes that you don’t overflow the stack
Simon Friis Vindum
@paldepind
Jun 09 2015 06:46
@jdalton That makes sense. I think laziness in compose is a solid feature. But Ramda needs it less since we have transducers. Maybe it could be built on top of transducers.
John-David Dalton
@jdalton
Jun 09 2015 06:54
Sure, I wasn't making suggestions just explaining how I do it since you asked.
Hardi Kõvamees
@luminarious
Jun 09 2015 06:58
@kedashoe That's exactly what I need, I hope it gets merged soon! Meanwhile @scott-christopher I'll probably just go with your suggestion. Speed is not so important as it's run as a on-demand build script anyway.
Thank you!
Simon Friis Vindum
@paldepind
Jun 09 2015 07:31
@jdalton Yes, I know. I meant I think it is a solid feature that's also why I brought it up originally.
Shane Keulen
@SeeThruHead
Jun 09 2015 15:41
hey peeps
anyone know what i'm doing wrong here
var getVals = R.map(R.compose(R.add(R.__, os.EOL), R.values));
Shane Keulen
@SeeThruHead
Jun 09 2015 15:52
nevermind i got it
var getValOnNewLine = R.compose(R.map(R.add(R.__, os.EOL)), R.values);
Juha Karttunen
@jkarttunen
Jun 09 2015 17:43
Any existing way to change
func()(func3(data), func4(data))
into
func()(func5(func3, func4))(data)
? Just cant figure this out, other than creating a custom function.
David Chambers
@davidchambers
Jun 09 2015 18:05
Sounds like R.converge might be useful.
Raine Virta
@raine
Jun 09 2015 20:39
at least looks a tad difficult to compose
Raine Virta
@raine
Jun 09 2015 20:55
I like when modules expose a simple function, instead of this