These are chat archives for ramda/ramda

2nd
May 2017
Joey Figaro
@joeyfigaro
May 02 2017 19:37
hey guys
If I have three arrays (users, revenue, billable) and I'm pushing objects to each inside of array.map, how can I use pipe or something similar to do it so I have a single function to return? http://joeysharesthings.com/0c242u3t2T0w
Currently unsure of how to cleanly return anything there, aside from returning the last array.push
Brad Compton (he/him)
@Bradcomp
May 02 2017 19:53
I would use reduce instead of map. Gimme a minute to spin up an example
Joey Figaro
@joeyfigaro
May 02 2017 19:56
@Bradcomp :100: :100:
Brad Compton (he/him)
@Bradcomp
May 02 2017 19:58
Here's the most obvious thing: https://goo.gl/4pV3vZ
You could probably do something with evolve in the reducer
Joey Figaro
@joeyfigaro
May 02 2017 19:59
rutroh - looks like ramdaRepl isn't defined. Not loading for me. :(
Brad Compton (he/him)
@Bradcomp
May 02 2017 20:00
@ram-bot
const metrics = [{
  users: 12,
  revenue: 100,
  billable: 50
}, {
   users: 1,
  revenue: 10,
  billable: 5
}]

reduce(({users, deposited, billable}, metric) => ({
  users: append(metric.users, users),
  deposited: append(metric.revenue, deposited),
  billable: append(metric.billable, billable)
}), {
  users: [],
  deposited: [],
  billable: []
}, metrics)
ram-bot looks ded too
but there is the code regardless
Joey Figaro
@joeyfigaro
May 02 2017 20:01
Thanks @Bradcomp! Comin' through again. :light_rail:
Brad Compton (he/him)
@Bradcomp
May 02 2017 20:03
(acc, metric) => evolve({
  users: append(metric.users),
  deposited: append(metric.revenue),
  billable: append(metric.billable)
}, acc)
Joey Figaro
@joeyfigaro
May 02 2017 20:16
@Bradcomp Do you have any suggested reading for doing common things in Ramda? DRYing up combining arrays and objects for starts.
Rick Medina
@rickmed
May 02 2017 20:17
@joeyfigaro maybe helpful: keep structure (same array length, different items shape) -> map. Decrease structure length, keep items shape -> filter. Change structure (like collapse to a single value or build an object) -> reduce or otherwise
Joey Figaro
@joeyfigaro
May 02 2017 20:17
Can you clarify a bit more @rickmed? Still a noob to FP/Ramda.
(or point to good reads) :)
Rick Medina
@rickmed
May 02 2017 20:18
@joeyfigaro just hints on when to use the right function...
Brad Compton (he/him)
@Bradcomp
May 02 2017 20:18
@joeyfigaro Nothing specific, have you read any of the articles in the wiki
Joey Figaro
@joeyfigaro
May 02 2017 20:19
Lol, of course there's stuff in the wiki. I hadn't looked in there - I was digging around google for ramda js practical examples because I was stumbling over the things I'd seen.
Thanks @rickmed and @Bradcomp :raised_hands:
Brad Compton (he/him)
@Bradcomp
May 02 2017 20:20
There's also this
Joey Figaro
@joeyfigaro
May 02 2017 20:21
Saw that guy - definitely good. The wiki tip was solid, too. :blush:
Brad Compton (he/him)
@Bradcomp
May 02 2017 20:23
I am of the opinion that there should be a link from the website to the wiki. It's easy to forget it's there
Joey Figaro
@joeyfigaro
May 02 2017 20:24
Yeah, I was consulting the site for docs and hadn't even hit the repo since first stumbling onto it.
Nadeem Bitar
@shinzui
May 02 2017 22:56
Hi everyone. Does anyone know of any good reference for using ramda with fluture?
Matthew Willhite
@miwillhite
May 02 2017 23:17
@shinzui Do you have a specific issue you are struggling with? Depending on what you are doing it should work just like more or less like Array or any other Functor (with map or chain for example)…
slight overstatement…
Nadeem Bitar
@shinzui
May 02 2017 23:19
@miwillhite I am new to using Future to control async flows and I'm struggling with creating non-trivial pipelines, so im looking for examples to learn from
Matthew Willhite
@miwillhite
May 02 2017 23:20
Ah ok, well first I’d suggest visiting the Fluture channel, @Avaq is often around and very helpful in guiding decisions around how to architect your pipelines
Nadeem Bitar
@shinzui
May 02 2017 23:21
I didn't realize that Fluture had a channel, I just joined, thanks.
Matthew Willhite
@miwillhite
May 02 2017 23:22
:thumbsup: :
Nadeem Bitar
@shinzui
May 02 2017 23:30
@miwillhite what's the Flutter channel, the one i found on gitter is for an ios project
Nadeem Bitar
@shinzui
May 02 2017 23:31
thanks