These are chat archives for ramda/ramda

Sep 2015
Scott Christopher
Sep 14 2015 00:00
If you were to use R.always(acc.concat(next).sort()), the concat and sort would evaluate every time, even if the ifElse predicate isn't satisfied.
Denis Stoyanov
Sep 14 2015 00:04
@scott-christopher Yes I did it already)
Tobias Pflug
Sep 14 2015 09:31
@scott-christopher thanks!
Tobias Pflug
Sep 14 2015 09:39
@scott-christopher If i just want to play around with some arbitrary generators how do I actually get values out so that I could try things in the repl?
Scott Christopher
Sep 14 2015 10:04
@gilligan It looks like you can use jsc.sampler, e.g.
var objArb = jsc.dict(jsc.oneof(jsc.string, jsc.array(jsc.string)));
// { '': [ 'ܜø', '˜–' ], 'p': [ '<³\u000f', '\u0006.' ], '¹/µ': '‰Ç' }
And to perform assertions:
jsc.assert(jsc.forall(objArb, obj => assert(something(obj))));
Tobias Pflug
Sep 14 2015 11:33
thanks again ;)
Aldwin Vlasblom
Sep 14 2015 13:25

I want to convert {email: ""} to {email: "", gravatar: "4b9bb80620f03eb3719e0a061c14283d"}. And I'm doing:

R.over(R.lens(R.prop("email"), R.assoc("gravatar")), emailToGravatarId)

But I feel like focusing the getter and setter of a lens on different parts of my data might be a bit hacky (non-idiomatic). I wonder what you guys think, and whether you can suggest an alternative?

Am I abusing lenses here, or is this just the thing they are meant to do?
Aldwin Vlasblom
Sep 14 2015 13:36
The reason I feel this might be abuse is because I wouldn't know what to name this lens; const emailAsAGetterButGravatarAsASetterLens = ...
Raine Virta
Sep 14 2015 13:44
depending on use, I may prefer
const setGravatarId = (obj) =>
  assoc('gravatar', emailToGravatarId(, obj);