anyone happen to know approximately how long the ramda mugs take to ship/arrive in the states? thinking about doing a giveaway at our next meetup, but its on may 4th, which might be cutting it close

you need star wars cups if its on may 4th

@joncfoo is that actually haskell syntax so that

`Set`

is a data constructor, or is that pseudo haskell syntax so that `Set`

is the idea of a mathematical set?
If it's the former, you could look at daggy or something. which would give you your pattern matching.

Or just do

`Maybe Bool`

, since it's isomorphic to it.
If it's the later, daggy wouldn't be so bad an idea either.

Hell, just daggy it anyway, but remove the

`Bool`

entirely
`data FieldState = Set | UnSet | NA`

or something

then you can definitely pattern match on it

Can I keep asking here what to use to do stuff? Feel like it's annoying lol.

@sotojuan Please do. It takes a decent effort to annoy most of us here :)

Ok let's try: I have an array of objects of the form

What I want is to, for every set of objects with the same

`{key: string, message: string}`

, for example `{key: 'A', message: 'Hello'}`

. There's objects with the same `key`

property in them that are related.What I want is to, for every set of objects with the same

`key`

value, reduce them down to a single object whose `message`

property is the `message`

of the related objects concatenated together. Essentially:```
let stuff = [{key: a, message: 'a'}, {key: a, message: 'hello'}, {key: b, message: 'bye'}, {key: b, message: 'good bye'}]
// => [{key: a, message: 'hihello'}, {key: b, message: 'byegood bye'}
```

One aprroach would be to group them by

`key`

and then just get the `message`

of each, reduce that to a string I want, and just return a new object/merge with any and return that
You should be able to use:

`R.reduceBy`

Error: No such function reduceBy

@ram-bot

```
const input = [{key: 'a', message: 'a'}, {key: 'a', message: 'hello'}, {key: 'b', message: 'bye'}, {key: 'b', message: 'good bye'}]
const fn = reduceBy((msg, obj) => concat(msg, obj.message), '', prop('key'));
fn(input);
```

`{ a: 'ahello', b: 'byegood bye' }`

Ah, sorry. I just realised you wanted a different output.

It'll end up pretty similar to what you were thinking.

@ram-bot

```
const input = [{key: 'a', message: 'a'}, {key: 'a', message: 'hello'}, {key: 'b', message: 'bye'}, {key: 'b', message: 'good bye'}]
const mergeFn = (k, l, r) => k === 'message' ? concat(l, r) : r
const fn = compose(map(reduce(mergeWithKey(mergeFn), {})), groupWith(eqProps('key')))
fn(input);
```

```
[ { key: 'a', message: 'ahello' },
{ key: 'b', message: 'byegood bye' } ]
```

@iamstarkov,

`S.pipe`

takes an array of functions. I did at one point make the case for `R.pipe`

doing the same, but didn't win that battle. ;)
Thanks @Avaq, It works like a charm

@jimf: the last one I ordered (Connecticut) took seven or eight days, I think.

`R.reduceBy`

goooood morning

Are there any guides on function parameter ordering ?

It often seems like I do this at random, but that a certain order may make a significant difference.

afaik, Ramda made a point of this when comparing to underscore ?

generally things you're likely to know beforehand come first

data last

Hi Raine

@CrossEye thanks! i'll place an order then and cross my fingers. worst case, we put it off til the june meetup

yeah, I'm watching "Underscore, you're doing it wrong!"

just grasped the need to pass data last :)

is data-last only because of "currying"?

or partial application

is there an inverse function of

`invert`

?
```
var raceResultsByFirstName = {
first: 'alice',
second: 'jake',
third: 'alice',
};
var inverted = R.invert(raceResultsByFirstName);
//=> { 'alice': ['first', 'third'], 'jake':['second'] }
inverseOfInvert(inverted) // should be equal to raceResultsByFirstName
```

how would you call this function if it does not exist?

Maybe

```
R.pipe(
R.toPairs
,R.map(R.reverse)
,R.zipObject
)
```

Or something to that affect

It could be lossy though depending on your data

Oh wow, Ramda's invert works differently to what I expected

thanks @keithn & @joneshf - I"ll have a look at daggy

Can someone check my understanding of transducers? I assumed this should spit out a 1 element array with a value of 1338 but it looks like the reduction part of transduction isn't working the way I thought it would:

http://goo.gl/fWr3Yf

http://goo.gl/fWr3Yf

@LeonineKing1199 Transducers compose in reverse.

Lol my bad! Hey, thanks for the correction! I was reading the docs and I was like, I *know* this should work. You've now helped me make my code drastically more bullet-proof and 1/10 procedural

Okay, another stupid question, how does one incorporate R.all into a transducer stack?

I have an array of potentially undefined objects, I want to pick a property from the defined objects and then I want the result of R.all(R.equals(true)) mapped over the filtered elements

Do I instead just do,

`R.all(R.equals(true), R.transduce(/* ... */))`

@LeonineKing1199 There is also a shortcut for transducing into an array http://goo.gl/2MVx9X

:+1:

Looks like

`all`

can act as a transducer, so you might be able to just put it in there
Or this maybe? http://goo.gl/Z1N2iE

I was able to yolo incorporate `all`

into the transformation stack and get back a 1 element array with a boolean so that's positive.

In my ideal world, I wouldn't get an array back but considering my ignorance on the accumulation behavior (not to mention the type change from Array to Boolean), I think this is "good enough"

And boom goes the dynamite

Ty @Bradcomp

Is it possible to do recursion in a point-free style, e.g. http://goo.gl/d5hFZ4

The function declaration above is only needed to make the recursion work

@davidgtonge good example

thanks - I'm experimenting with extreme point-free style and finding it frustrating that I have to use function declaration to enable recursion

Yes, maybe using es6 syntax http://goo.gl/jGIkjn

Thanks - but that still requires declaring the argument

yes :worried:

@davidgtonge I'm not sure what you're trying to do is possible *in Javascript*. When you put it in a function (arrow or regular) you are creating a new scope, that doesn't get evaluated until the function is invoked. That guarantees the fibonacci will be defined at the time it gets called. Without that scope, the variable doesn't get bound to the value until after you define the function, so it will always be

`undefined`

when you pass it into `converge`

thanks @Bradcomp thought so

finding it frustrating that I have to use function declaration to enable recursion

you could do anonymous recursion using the Y combinator. But why would you? You can name things and refer to them by name. That's pretty handy.

```
function Y(f) {
var p = function(h) {
return function(x) {
return f(h(h))(x);
};
};
return p(p);
}
Y(function(f) {
return function(n) {
return n < 2 ? n : f(n-1) + f(n-2); // guts of the fibonacci sequence, anonymously
};
})(10) //=> 55
```

I'm going bat shit crazy trying to get

`converge`

to work this example was lifted from the docs it is wrapped in a Jasmine test
```
it( 'converge', function() {
var add = (a, b) => a + b;
var multiply = (a, b) => a * b;
var subtract = (a, b) => a - b;
//≅ multiply( add(1, 2), subtract(1, 2) );
const test = R.converge(multiply, [add, subtract])
expect( test( 1, 2 ) ).toEqual( -3 );
} );
```

and I get a

`Error: First argument to _arity must be a non-negative integer no greater than ten`

@ChetHarrison that's strange. It seems to work for me.

@ram-bot

```
var add_ = (a, b) => a + b;
var multiply_ = (a, b) => a * b;
var subtract_ = (a, b) => a - b;
R.converge(multiply_, [add_, subtract_])(1, 2)
```

`-3`

Yeah. Maybe I should have a martini and see if that helps.

If I were to guess, I'd say that

`converge`

can't work out the arity of your `multiply`

function.
Are you using anything to translate the fat arrow functions that could potentially be messing with the arity?

Thanks for checking

hmm I am transpiling my tests with babel. Thats a good thought let me see what the ES5 looks like

e.g. try the following and see whether it gives you the same error

@ram-bot

```
var add_ = function(a, b) { return a + b };
var multiply_ = function(a, b) { return a * b };
var subtract_ = function(a, b) { return a - b };
R.converge(multiply_, [add_, subtract_])(1, 2)
```

`-3`

hmm same error

Which version of Ramda are you using?

0.17.1

It sounds like the error you get when you forget the square braces.

I think

`converge`

was variadic in 0.17
So my error in reverse. Could be.

Try

`const test = R.converge(multiply, add, subtract)`

I should yank the trailing underscores?

Sorry, I just had those in there for @ram-bot to prevent clashing with functions in Ramda with the same name.

k. I have it namespaced

I tried to simplify it down to

`R.converge( R.add, [ R.add, R.add] )( 1, 1 );`

and got the same error

Yep, you'll need to remove the array and just pass them as separate arguments.

ahh gotcha

In 0.17,

`converge`

and `useWith`

were still variadic.
it worked

:sparkles:

:thumbsup: :

looks like we need to update the docs

```
var add = (a, b) => a + b;
var multiply = (a, b) => a * b;
var subtract = (a, b) => a - b;
//≅ multiply( add(1, 2), subtract(1, 2) );
R.converge(multiply, [add, subtract])(1, 2); //=> -3
var add3 = (a, b, c) => a + b + c;
R.converge(add3, [multiply, add, subtract])(1, 2); //=> 4
```

Sorry, what in particular needs to be updated?

that example code has the [ ]

`converge`

and `useWith`

were converted to binary functions at some stage (I think 0.18) so they accepted an array of functions as the second argument.
ah gotcha. Serves me right for not staying current

:)

so my version will only take 2 branching functions?

It should take as many as you give it.

k good to know

So the

`add3`

example above should work in 0.17 if you remove the `[]`

.
roger that

I just updated to the latest and got a

`Error: define: reduce: list must be array or iterable`

. I grepped on `reduce`

and found one line where I am using it but looks ok. Any Ideas on where to go looking?
Hard to say. You could have a squiz through the various upgrade guides to see what has changed. https://github.com/ramda/ramda/issues?q=label%3A"upgrade+guide"

Otherwise you could set a breakpoint where that error is thrown and have a look back up the stack for clues.

@ChetHarrison It could also be some other function that uses

`reduce`

internally
k thanks! Super excited to move past that one. I have been refactoring away on some old code and I like the way it looks now