These are chat archives for ramda/ramda

20th
Feb 2016
Hardy Jones
@joneshf
Feb 20 2016 02:27
@kujon no, although they might have similar implementations, they're used for entirely different things
@kujon reader is just a data type representing functions, and io is just a data type representing input/output effects
Asaf
@asaf-romano
Feb 20 2016 16:53
@CrossEye : is there any internal utility for shallow cloning?
I need to clone the accum in into, but I don't think we want deep cloning there.
Asaf
@asaf-romano
Feb 20 2016 17:02
nvm, just added a flag to _clone
Ricardo Pallas
@RPallas92
Feb 20 2016 18:08
Hello!, I need some help
This message was deleted
This message was deleted
var populateAnimal = R.curry(function(animal, owner, vaccines){
    var setOwner = R.set(R.lensProp('owner'), owner); 
    var setVaccines = R.set(R.lensProp('vaccines'), vaccines); 
    return R.compose(setOwner, setVaccines)(animal)
})

var animalFromFlatAnimal = function(animal){
     return getOwnerById(animal.owner).chain(function(owner){
        return getVaccinesByIds(animal.vaccines).map(function(vaccines){
            return populateAnimal(animal, owner, vaccines)
        })
    })
}

var getAnimalsByPage = function(pageNumber, pageSize) {
    return getFlatAnimalsByPage(pageNumber, pageSize).chain(function(animals){

        return R.map(animalFromFlatAnimal, animals)



    })
}
getFlatAnimalsByPage is a Task that returns an array of objets animal
I need to apply animalFromFlatAnimal to every elemnt of the array
animalFromFlatAnimal returns a Task
so i Have an array of Tasks
but I need to return a single task
that combines all tasks, like promise.all
Raine Virta
@raine
Feb 20 2016 18:19
so I believe it would be getFlatAnimalsByPage(pageNumber, pageSize).chain(traverse(animalFromFlatAnimal))
Ricardo Pallas
@RPallas92
Feb 20 2016 18:24
Yes! that’s what I need, thank you @raine
Asaf
@asaf-romano
Feb 20 2016 18:34
Can I create a branch from another branch that's already PRed, and then publish that branch as another PR?
or should I rather wait for the first one to land
Raine Virta
@raine
Feb 20 2016 18:35
it's tricky, the second PR will have diff of the first PR too
Asaf
@asaf-romano
Feb 20 2016 18:36
that's remarkably stupid.
I'll wait then.
Raine Virta
@raine
Feb 20 2016 18:37
i don't see how that could be avoided
Asaf
@asaf-romano
Feb 20 2016 18:38
The part that cannot be avoided is that you'd have to merge in the first PR first.
but the fact that one can send a patch for a review on its on, that's pending on a larger change is a github issue, I think/
Raine Virta
@raine
Feb 20 2016 18:39
i don't see how that's the case
Asaf
@asaf-romano
Feb 20 2016 18:39
how so?
I added an internal function in one PR. I want to use it in another PR.
of course, the original PR in that case blocks the merge of the other.
Raine Virta
@raine
Feb 20 2016 18:40
i suppose it's technically doable for github to detect ah this another PR by this dude contains commits that are already introduced in a PR that was created before, let's not show those in the diff or something like that
Asaf
@asaf-romano
Feb 20 2016 18:41
indeed
Raine Virta
@raine
Feb 20 2016 18:41
but from git's point of view both of your branches just introduce the same changes except the second one a few more
Asaf
@asaf-romano
Feb 20 2016 18:43
I miss mercurial :(
well, at least the way we used it in mozilla.
hrm, some claim it's only an issue if I use the same branch
Raine Virta
@raine
Feb 20 2016 18:46
same branch?
not related to the previous comment
going to read that now
seems like the same situation
Raine Virta
@raine
Feb 20 2016 18:48
at work i usually make the second PR and remark that some other PR should be merged first, after which i'll rebase the second branch on master if necessary
Asaf
@asaf-romano
Feb 20 2016 18:50
interestingly, that guy says this is not an issue on launchpad because there you can, indeed, mark another PR as a dependency
Raine Virta
@raine
Feb 20 2016 18:50
yeah, that could work, instead of the system trying to be smart and do it automatically
GÁBOR Áron Zsolt
@ashnur
Feb 20 2016 22:07
if I have const funcs = [f,g,h ...] and const value = "foo" is there a nicer way to do funcs.map((fn) => fn(value)) ?
Scott Sauyet
@CrossEye
Feb 20 2016 22:15
R.juxt
Scott Sauyet
@CrossEye
Feb 20 2016 22:17
@ram-bot R.juxt([R.add(10), R.multiply(2), R.dec])(5);
ram-bot
@ram-bot
Feb 20 2016 22:17
[ 15, 10, 4 ]
Asaf
@asaf-romano
Feb 20 2016 22:25
@CrossEye regarding that Collector.of ticket; it's a little hard to demonstrate how to use it nicely with vanila js; but, for instance, immutable.js's asMutable gets close to how that java api is is used (usually you work with a builder as the accumulator, and the finalizer calls builder.build, which returns an immutable object)
anyway, replied on the ticket itself with vanilla js
Here are some relatively simple examples of how the java api is used: https://gist.githubusercontent.com/anonymous/26282bfa98bad31bbc94/raw/74a1e3458e931989c08601ead5059516069fe03b/ImmutableMap.java (again, ignore the combiner argument, which is used for parallel streams)