These are chat archives for ramda/ramda

20th
Mar 2016
Risto Stevcev
@Risto-Stevcev
Mar 20 2016 00:59
@kwijibo That's true
Risto Stevcev
@Risto-Stevcev
Mar 20 2016 01:20
@GrosSacASac It's an interesting little project. I think it's selling point might be that it's small in scope. A potential problem is that a lot of apps might want to do more than (or maybe never) two-way bind, such as rendering a dynamic template, in which case they might use someting more feature rich like React which already supports two-way binding.
DOM compuations can be expensive too. If your lib isn't using a virtual dom, you might want to check out this
There's also an Angular-like library that's more stripped down and simpler called Vue. FRP libs like CycleJS, Most, Kefir, Bacon, etc also by default support two-way binding, though I'm not sure if they use virtual DOMs (might depend on lib).
Walle Cyril
@GrosSacASac
Mar 20 2016 01:26
virtual DOM is a solution for a problem my library doesn't have to begin with. You can define dynamic templates with my libraries as well, but I didn't directly explain how to do it. I will finish the readme tomorrow to explain exlplicitly how to define dynamic templates
The link you send does explain what problem virtual dom solves
Risto Stevcev
@Risto-Stevcev
Mar 20 2016 01:33
Yeah, I guess if it's only binding to one element it wouldn't need it
More feature rich two-way binding might manipulate an entire section of the DOM, like a list or table
Walle Cyril
@GrosSacASac
Mar 20 2016 01:41
You can do that ! As I said, the documentation is still under construction
Risto Stevcev
@Risto-Stevcev
Mar 20 2016 02:29
Then there would be a use for a virtual DOM to avoid an expensive re-render
Aldwin Vlasblom
@Avaq
Mar 20 2016 15:24
I created an overview highlighting the differences between some of the Future implementations out there. It's a question I see asked a lot, and one I've answered a lot. From now one we can refer to: https://github.com/Avaq/Fluture/wiki/Comparison-of-Future-Implementations
Andy Steinberg
@HolyMeekrob
Mar 20 2016 16:47
I've either found a bug or I'm confused about how curry works.
fooA(n) returns the expected array
fooB(n) returns a function
const getSequence = R.times(R.identity);

const isDivisibleA = (x) => (y) =>  x % y === 0;
const isDivisibleB = R.curry((x, y) => x % y === 0);

const fooA = R.converge(R.call, [R.compose(R.filter, isDivisibleA), getSequence]);
const fooB = R.converge(R.call, [R.compose(R.filter, isDivisibleB), getSequence]);
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:02
@HolyMeekrob It's because R.compose behaves differently with functions of different arity. isDivisibleB correctly reports arity 2 because R.curry made sure of that.
@ram-bot R.compose(R.filter, (a) => a) // returns a unary function
ram-bot
@ram-bot
Mar 20 2016 17:03
[Function]
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:04
Oh. Rambot doesn't cast to string. :P
Andy Steinberg
@HolyMeekrob
Mar 20 2016 17:04
Aha, that makes sense
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:04
@ram-bot R.compose(R.filter, (a) => a).toString()
ram-bot
@ram-bot
Mar 20 2016 17:04
'function (a0) {\n                return fn.apply(this, arguments);\n            }'
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:05
@ram-bot R.compose(R.filter, (a, b) => a + b) // returns a binary function
ram-bot
@ram-bot
Mar 20 2016 17:05
[Function]
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:05
Blast. Forgot toString again..
@ram-bot R.compose(R.filter, (a, b) => a + b).toString()
ram-bot
@ram-bot
Mar 20 2016 17:05
'function (a0, a1) {\n                return fn.apply(this, arguments);\n            }'
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:05
There. a0, a1. :P
David Chambers
@davidchambers
Mar 20 2016 17:06
There's another way to show the difference.
@ram-bot
R.compose(a => a).length
ram-bot
@ram-bot
Mar 20 2016 17:06
1
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:07
Right, of course. >.<
David Chambers
@davidchambers
Mar 20 2016 17:07
@ram-bot
R.compose((a, b) => a + b).length
ram-bot
@ram-bot
Mar 20 2016 17:07
2
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:08
Wait, what?
You're composing one function, meaning compose is partially applied, awaiting it's next function yet still it already reports arity. o.0
I would expect compose(x => x) to report arity 2, for "another function and the argument to x => x". And compose((a, b) => a + b) to report arity 3 for "another function, the argument a and the argument b".
Oh wait, no. It wouldn't know yet because the function it's awaiting would define the arity.
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:13
So it's impossible for compose(f) to report any arity other than 1, for "function to compose with".
Which makes R.compose((a, b) => a + b).length //> 2 quite surprising.
Ohh, never mind. Apparantly composing a single function is okay with Ramda. :)
Andy Steinberg
@HolyMeekrob
Mar 20 2016 17:17
I just discovered that as well
@ram-bot
R.compose(R.inc)(5);
ram-bot
@ram-bot
Mar 20 2016 17:17
6
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:17
Yeah..
Andy Steinberg
@HolyMeekrob
Mar 20 2016 17:17
I don't know if it's the cleanest, but it looks like calling curryN(1) on the curried function allows it to compose correctly
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:18
Yeah, there's unary as a short-cut. :)
Andy Steinberg
@HolyMeekrob
Mar 20 2016 17:19
Oh, cool!
Aldwin Vlasblom
@Avaq
Mar 20 2016 17:21
I always use S.compose and S.pipe from Sanctuary, which are way less surprising.
Ravi Varanasi
@RaviVaranasi
Mar 20 2016 17:45
I have a very simple basic question - is there anyway to specify R.propNotEq('lastName', undefined) ? R.not does not work since the fn is curried
Lewis
@6ewis
Mar 20 2016 17:59
!R.propEq('lastName', undefined)
Aldwin Vlasblom
@Avaq
Mar 20 2016 18:01
f = R.propSatisfies(R.complement(R.isNil), 'lastName') would work if you're okay with f({lastName: null}) to be false. Otherwise you can always R.propSatisfies(x => x !== undefined, 'lastName')
Lewis
@6ewis
Mar 20 2016 19:55
@Bradcomp What are your favorite ressources for fp
Lewis
@6ewis
Mar 20 2016 20:02
@CrossEye How can I run your func programming slides
Walle Cyril
@GrosSacASac
Mar 20 2016 20:15
@Risto-Stevcev here's a more complete demo http://rawgit.com/GrosSacASac/DOM99/master/examples/chat.html
Brad Compton (he/him)
@Bradcomp
Mar 20 2016 20:28
@6ewis I really like the mostly adequate guide https://github.com/MostlyAdequate/mostly-adequate-guide
I learned a lot of the basic concepts from Learn You a Haskell http://learnyouahaskell.com/
Yes it's Haskell but the concepts I learned have served me well.
Lewis
@6ewis
Mar 20 2016 20:44
@Bradcomp if you had to pick one which one would you pick
Brad Compton (he/him)
@Bradcomp
Mar 20 2016 20:45
@6ewis Definitely the mostly adequate guide :-D
Lewis
@6ewis
Mar 20 2016 20:47
@Bradcomp what stack do you use on the backend
Brad Compton (he/him)
@Bradcomp
Mar 20 2016 20:49
@6ewis Javascript! We use Node with MongoDB and Express.
Keith Nicholas
@keithn
Mar 20 2016 22:33
@Gewis Meteor for the backend FTW :)
Lewis
@6ewis
Mar 20 2016 23:04
@Bradcomp I see. thanks