These are chat archives for ramda/ramda

31st
Oct 2017
Jonah
@jonahx
Oct 31 2017 00:09
@polytypic couldn’t agree more :thumbsup:
Michael Rosata
@mrosata
Oct 31 2017 02:01
@polytypic I agree with what your saying. Point-free is an important step in learning functional programming, but after taking that step many people (myself included for awhile), get hung up on writing point free code. Coming out of that though, I feel programmers have more sense of what is right and wrong, nothing wrong with creating variables as long as they don't introduce impurities into parts of the code that could easily be referentially transparent. I do have a question on only 1 line from the paragraph, not because I disagree with the statement, if you have time for an example I think it would help me understand better. "In contrast, a program component that exposes or exhibits procedural techniques (e.g. monadic operations with local state) is not referentially transparent in the larger picture and can make reasoning about the whole much more difficult (step-by-step vs compositional reasoning) even if the component is internally implemented using only purely functional techniques."
I'm heading offline for the night, so it's not critical
David Komer
@dakom
Oct 31 2017 10:09

Is there a guide somewhere about how to rewrite things that require passing args to the inner functions to be cleaner? I guess that’s a bit vague, but I have this chunk of code I’m working through:

const setTransform = parent => R.when(
  R.has("@@transform"),
  props => R.set(mLens, getLocalMatrix (parent) (getTransformMeta(props)))(props)
);

And that second line is nasty… I’m sure it can be written much more nicely but I’m not seeing it yet. Note that if I simplify at least to just R.set(mLens, getLocalMatrix (parent) (getTransformMeta(props))) then getLocalMatrix gets called right away which is not good

David Komer
@dakom
Oct 31 2017 10:14
actually it’s not so bad when inlining more stuff and splitting into more lines:
const setTransform = parent => R.when(
  R.has("@@transform"),
  props => {
    const transformData = R.view (R.lensProp("@@transform")) (props);
    const updatedMatrix = Float32Array.from([parent.x, transformData.x, parent.x + transformData.x]); //just for repl testing

    return R.set (mLens) (updatedMatrix) (props)
  }
);
Brad Compton (he/him)
@Bradcomp
Oct 31 2017 17:18
Happy :jack_o_lantern: everybody!
Paul
@pauloliver
Oct 31 2017 17:33
:skull:
Vasili Sviridov
@vsviridov
Oct 31 2017 17:33
R.always('spooky')
A
@dizzyone
Oct 31 2017 17:49
hey guys, I'm trying to improve on this pascal triangle snippet, trying to write it in ramda, any help? https://goo.gl/Dg27cN
it's kind of unreadable, and I don't know how to improve on nesting map's and chain's to get the resulting array of sets
pentatronix
@pentatronix
Oct 31 2017 18:31
arian‮
@arian-swydo
Oct 31 2017 19:03
mmm just realised there is a much simpler formula for the coefficients...
A
@dizzyone
Oct 31 2017 22:02
noone cares, but if anyone does: https://goo.gl/5FUMxx
any feedback on improving appreciated
Denis Stoyanov
@xgrommx
Oct 31 2017 22:08
@dizzyone pt is not defined
A
@dizzyone
Oct 31 2017 22:20
oh crap wrong share maybe
Denis Stoyanov
@xgrommx
Oct 31 2017 22:23
heh) I have version via algebra of polynominal https://goo.gl/596YkX
A
@dizzyone
Oct 31 2017 22:24
thanks for sharing :) gonna try and figure it out
A
@dizzyone
Oct 31 2017 22:30
nice way of using Array.from(), much better than Array.apply(0,new Array(10)).map()
pentatronix
@pentatronix
Oct 31 2017 22:32
@xgrommx : Very nicely done!
Denis Stoyanov
@xgrommx
Oct 31 2017 22:36
@dizzyone no) Array.from more readable)
A
@dizzyone
Oct 31 2017 22:39
yours is indeed way nicer
pentatronix
@pentatronix
Oct 31 2017 22:57
Ok, quick question: Is there a similar concept of lenses for arrays in Ramda? like get/set of a particular column?
Still a newbie so still getting my bearings
A
@dizzyone
Oct 31 2017 23:02
maybe not what you're looking for, but do you mean something like lensIndex?
pentatronix
@pentatronix
Oct 31 2017 23:17
@dizzyone Ahh looks like it is
A
@dizzyone
Oct 31 2017 23:24
blog linked in the wiki mentioned for composing you should use lensPaths (something about possible TypeErrors): https://goo.gl/gfi7y1
Denis Stoyanov
@xgrommx
Oct 31 2017 23:37
lensIndex