These are chat archives for ramda/ramda

10th
Dec 2017
Adam Szaraniec
@mimol91
Dec 10 2017 07:00

@mimol91 Your solution is OK, however it isn't reusable due to the mutation of the accumulator. I have seen this sort of thing lead to subtle bugs in the past. See here

WOW, I will never thought about it.
Thanks all for helping

Kurt Milam
@kurtmilam
Dec 10 2017 08:48
const result = x => R.ifElse(
  banks => R.uniq(banks).length !== banks.length,
  banks => banks.length - 1,
  pipe(createNewState, result) // this is what I meant to post earlier
)(x)
Tomáš Konrády
@tommmyy
Dec 10 2017 14:20

Hello! I am excited to announce a new version of Ramda Extension. Now with Ramda-style docs!

Github: https://github.com/tommmyy/ramda-extension
Homepage & Docs: https://ramda-extension.firebaseapp.com

We will be glad for boot feedback and PRs!

Brad Compton (he/him)
@Bradcomp
Dec 10 2017 20:25

@peterchappy Javascript is evaluated eagerly, which prevents us from being able to create point free recursive functions. When assigning a value to a variable, the right side will be evaluated, then assigned to the variable on the left. So when you generate the function result it evaluates the expression before assigning the result of that expression to result, the variable. At the time the variable is evaluated on the right it has no value assigned on the left.

By wrapping the recursive call in an arrow function, you delay evaluation until the variable gets assigned, and thus avoid the whole issue.

Neeraj Singh
@neerajdotname
Dec 10 2017 20:32
@tommmyy thanks for shipping. I could see using many functions listed there particularly log and trace.
Tomáš Konrády
@tommmyy
Dec 10 2017 22:46
@neerajdotname Yes :) every function listed is based on need in real projects we have worked on