These are chat archives for ramda/ramda

14th
Oct 2015
Niloy Mondal
@niloy
Oct 14 2015 05:28
@davidchambers I've updated my PR based on your input
Raine Virta
@raine
Oct 14 2015 06:47
any ideas how R.filter could be applied to a node stream in a sensible way?
as if to treat the stream as a collection
Niloy Mondal
@niloy
Oct 14 2015 07:11
If R.filter could be made to work with ES6 iterators, the node stream could be converted to an Iterator
Vladimir Starkov
@iamstarkov
Oct 14 2015 08:19
@joneshf-work1 take a look at mine issue then iamstarkov/generator-travis#2
@joneshf-work1 unfortunately ramda version didnt pass tests, so I fall back to lodash version, here https://github.com/iamstarkov/merge-and-concat/blob/master/test.js
Scott Christopher
@scott-christopher
Oct 14 2015 08:26
@iamstarkov I raised this PR in response to your earlier conversation. Feel free to leave a comment if it helps your use case or not. ramda/ramda#1443
Constantin Dumitrescu
@dumconstantin
Oct 14 2015 10:03
heya everyone, quick question... what should I use to make a list out of the arguments of a function? e.g.
R.converge(toArrayFromArgs, R.always('a'), R.always('b')); // => ['a', 'b']
Constantin Dumitrescu
@dumconstantin
Oct 14 2015 10:37
@raine Thanks! Ugh sorry about that, forgot to check the Cookbook
Raine Virta
@raine
Oct 14 2015 10:40
with ES6 it's just (...args) => args
Constantin Dumitrescu
@dumconstantin
Oct 14 2015 10:42
nice! have to get my hands dirty with ES6, didn't get to do that yet :)
Hardy Jones
@joneshf
Oct 14 2015 11:22
@iamstarkov Jawesome! Thanks!
boxofrox
@boxofrox
Oct 14 2015 16:19
@joneshf, I don't see how R.ap would work in my situtation. Trying to take [f, g, h] and [x, y, z] and output [f(x), g(y), h(z)]. R.zipWith(R.call) works, but the description of R.ap suggests I'd get [f(x), f(y), f(z), g(x), g(y), g(z), h(x), h(y), h(z)], no?
Jethro Larson
@jethrolarson
Oct 14 2015 17:08
You would, yes. I think @joneshf mistook your intent
boxofrox
@boxofrox
Oct 14 2015 17:10
yea, i didn't think i was very clear their first time. thanks, @jethrolarson.
Tobias Pflug
@gilligan
Oct 14 2015 18:25
hm, could someone explain the motivation for not having both and either not short-circuit anymore ? is it a side effect or the actually change intended ?
Trying to upgrade my code base to 0.18.0 right now and that is a bit of a bummer for me right now ;-)
I see the implementation has been changed to R.lift(and) which looks nice and all but the practical implications seem rather meh to me
I would think that code like R.both(R.complement(R.isNil), f) would be common where f is some predicate that operates on a non-undefined input which now obviously fails
Raine Virta
@raine
Oct 14 2015 18:30
I sort of agree
part of the problem may be that both as a name gives no hint about the short-circuiting property
Tobias Pflug
@gilligan
Oct 14 2015 18:31
so this really looks like a case where this is cool from a theoretical/implementation standpoint overruled the practical use cases
Raine Virta
@raine
Oct 14 2015 18:31
I've used both exactly like you have there
Tobias Pflug
@gilligan
Oct 14 2015 18:32
@raine what would you suggest I should replace it with then ?
Raine Virta
@raine
Oct 14 2015 18:32
allPass was my alternative
not nearly as nice if you have just two predicates
Tobias Pflug
@gilligan
Oct 14 2015 18:33
right.
I should follow ramda developments more closely
Tobias Pflug
@gilligan
Oct 14 2015 18:56
hm, I am somewhat confused about ap
the documentation says : Dispatches to the ap method of the second argument, if present. Also treats functions as applicatives.
I thus (apparently wrongfully) assumed R.ap([f], g) would be equivalent to R.map(f,g) ?
Raine Virta
@raine
Oct 14 2015 19:02
Installed into REPL context:
 - ramda@0.18.0 as R
> ap(of(add(1)), [1,2,3])
[ 2, 3, 4 ]
> map(add(1), [1,2,3])
[ 2, 3, 4 ]
>
Tobias Pflug
@gilligan
Oct 14 2015 19:06
ah, hm.. hang on i think i mixed something up ;)
what is the repl you are using there by the way ?
also what is providing of in your context ?
Raine Virta
@raine
Oct 14 2015 19:10
ramda
Tobias Pflug
@gilligan
Oct 14 2015 19:11
doh sorry never mind
Raine Virta
@raine
Oct 14 2015 19:12
and replem
Tobias Pflug
@gilligan
Oct 14 2015 19:13
ah, perfect
that is exactly what I have been looking for and half considered to put together myself - now you freed me of that burden :)
Raine Virta
@raine
Oct 14 2015 19:14
lol. good to hear
ideas welcome
Tobias Pflug
@gilligan
Oct 14 2015 19:15
es6 support
how can i integrate babel ?
Raine Virta
@raine
Oct 14 2015 19:15
well, i just use v4 node
you need babel features?
Tobias Pflug
@gilligan
Oct 14 2015 19:15
no no.. you are right
i should just update to node4
Raine Virta
@raine
Oct 14 2015 19:16
updating to v4 has the benefit of fixing autocomplete in repl
Tobias Pflug
@gilligan
Oct 14 2015 19:16
we had some breaking packages before but that's been long fixed so no reason for me to sit on 3.x
Tobias Pflug
@gilligan
Oct 14 2015 19:25
uhrm
R.isEmpty(function () {}) // -> true ramda 0.17.1
R.isEmpty(function () {}) // -> false ramda 0.18.1
not entirely sure what the theory/logic behind isEmpty is anyway - it just does not make sense for functions or does it ?
Raine Virta
@raine
Oct 14 2015 19:30
no clue
Tobias Pflug
@gilligan
Oct 14 2015 19:31
R.empty returns undefined for function () {} as well
so that fits
Tobias Pflug
@gilligan
Oct 14 2015 19:38
ramda/ramda#1242
alright - got it
oops, there is a broken link in http://ramdajs.com/0.18.0/docs/#map ;-)
Raine Virta
@raine
Oct 14 2015 19:44
transducing with ramda-cli is seriously cool
$ echo '1 2 2 4 4 5' | R --transduce drop-repeats
1
2
4
5
cat countries.json | R --transduce 'filter (.name.length > 30)' -c
{"name":"Heard Island and Mcdonald Islands","code":"HM"}
{"name":"Palestinian Territory, Occupied","code":"PS"}
{"name":"Saint Vincent and the Grenadines","code":"VC"}
solves the problem of having to collect all items before filtering etc. so basically should be able to do operations on incomplete streams like filtering json delimited logs as they come
Scott Christopher
@scott-christopher
Oct 14 2015 19:53
@boxofrox I believe @joneshf was suggesting that ap was semantically the correct function to use, however the default implementation for lists won't do what you want. An alternative implementation for lists is to zip the lists together pair-wise (e.g. the ZipList in Haskell), but that would require creating a new data type to wrap the list and attach the ap method to.
Tobias Pflug
@gilligan
Oct 14 2015 19:56
just a tought - R.when could easily be implemented through R.ifElse. Is there a reason for not doing this ?
Tobias Pflug
@gilligan
Oct 14 2015 20:04
@scott-christopher do you plan to invest any more time on https://github.com/ramda/ramda/compare/master...scott-christopher:prisms ?
Scott Christopher
@scott-christopher
Oct 14 2015 20:26
Yeah, I am planning to. Time just hasn't been my friend lately.
I was planning on dedicating some time for ramda-fantasy this weekend, so I'll try give it some more time then.
Tobias Pflug
@gilligan
Oct 14 2015 20:31
;-)
David Chambers
@davidchambers
Oct 14 2015 21:08

R.when could easily be implemented through R.ifElse. Is there a reason for not doing this ?

It would be something like R.when = R.ifElse(R.__, R.__, R.identity), which isn't necessarily an improvement on what we have now (since it would add three dependencies).

Tobias Pflug
@gilligan
Oct 14 2015 21:26
@davidchambers alright, thanks for the feedback
Denis Stoyanov
@xgrommx
Oct 14 2015 22:08
@raine This doesn't work echo '1 2 2 4 4 5' | R --transduce drop-repeats