These are chat archives for ramda/ramda

28th
Oct 2017
Tushar Mathur
@tusharmath
Oct 28 2017 01:50
any particular reason for R.o to work only with 3 args?
I was really happy to see this function come to Ramda but then i learnt it only works with 3 args :(
pentatronix
@pentatronix
Oct 28 2017 02:29
I see some mentioning of lazy evaluation (Similar to Lazy.js) in some of the articles for Ramda, is this actually in anywhere?
pentatronix
@pentatronix
Oct 28 2017 02:41
And yet another question, the same article (http://fr.umio.us/the-philosophy-of-ramda/) mentions that tail call recursion isn't being used or encouraged in Ramda, has this changed since it has been added to ES6+?
Tomáš Konrády
@tommmyy
Oct 28 2017 13:55
@tusharmath for me it is good for readability... if you use 'compose' then there is no limititation and from my experience I saw really long compositions that could be breakdown to smaller reusable ones.
Tushar Mathur
@tusharmath
Oct 28 2017 13:57
@tommmyy I think readability shouldn't be enforced by a library such as ramda
Its very subjective, sometimes its more readable to have one large composition rather than many tiny ones
Tomáš Konrády
@tommmyy
Oct 28 2017 13:59
@tusharmath why? In Ramda is pretty simple to write pretty badly readable code.. maybe it would be useful for community to start write style-guide for using of Ramda
Tushar Mathur
@tusharmath
Oct 28 2017 14:00
I agree with you. But as you said it should be a "guide" and not a "restriction"
these are just my thoughts :)
Tomáš Konrády
@tommmyy
Oct 28 2017 14:01
@tusharmath sure I said mine about "o" :)
@tusharmath see ramda/ramda#2127
Tushar Mathur
@tusharmath
Oct 28 2017 14:05
@tommmyy Not sure what I am looking at.
Tomáš Konrády
@tommmyy
Oct 28 2017 14:07
@tusharmath issue about "o". I found it interesting
Tomáš Konrády
@tommmyy
Oct 28 2017 14:41
@PygmalionPolymorph @Yord This should work too:
const unfoldObject = o(
  o(mergeAll, values),
  mapObjIndexed(
    useWith(flip(call), [identity, compose(apply(compose), map(objOf), split('.'))])
  )
 );

unfoldObject({'a.b.c': 1, 'd.e.f': 2, 'g': 3})
James Forbes
@JAForbes
Oct 28 2017 14:53
@tusharmath The fact o is binary allows for some very powerful and predictable combinator logic. You can do things with o that are not possible with R.compose without introducing additional lambdas because R.compose accepts 0-n args, while o is always 2 (3 if you count the function it returns as part of the signature).
@Sten-H yep, that's exactly what's going on :+1:
Ashish Gupta
@gotoashishgupta
Oct 28 2017 17:42
I was just thinking.. how to flip imperative thought in being functional?
arian‮
@arian-swydo
Oct 28 2017 18:14
you mean how to switch your thinking from imperative to functional? Or is it a combinatory joker joke that us procedural jokers don’t get?
arian‮
@arian-swydo
Oct 28 2017 18:19
so, I have a question, I asked my wife, but she stopped listening ever since our marriage. I’m experimenting with lenses and I’m trying a clean way to compose two lenses I have in use in different places: https://goo.gl/V8tjFH
I want to add the encode/decode on top of the existing null/“”
but if I compose the encode/decode first it doesn’t work, and afterwards it does work when setting, but I don’t want to decode before checking if it is null, does this make any sense??
arian‮
@arian-swydo
Oct 28 2017 18:34
actually nevermind, I’ll just change the encode to check for null as well
still trying to figure out the power of composing lenses :)
Kurt Milam
@kurtmilam
Oct 28 2017 18:36
@arian-swydo definitely take a look at the partial.lenses library, where you'll find a number of pre-built abstractions and examples that may make things clearer.
arian‮
@arian-swydo
Oct 28 2017 18:46
thanks @kurtmilam
Kurt Milam
@kurtmilam
Oct 28 2017 18:49
You bet. You can ask questions about partial.lenses (and lenses in general) in the calmm-js Gitter, as well.
arian‮
@arian-swydo
Oct 28 2017 20:16
woah, woah. I haven’t even gotten to data types yet, somebody close pandora’s box.