Hi guys,

Would be there any improvements on this?

Would be there any improvements on this?

```
const getAll = (id) => {
return pipe(
when(
always(def(id)),
filter(pipe(prop('foo'), includes(id)))
),
map(omit('foo'))
)(items);
};
```

The

`getAll`

function simply returns all the `items`

(which are outside the function, not the best thing, but nevertheless) but if the `id`

is provided the function returns a subset of `items`

by filtering them.
what is

`def`

?
`const def = (x) => typeof x !== 'undefined';`

`def`

stands for `isDefined`

basically
`filter(pipe(prop('foo'), includes(id)))`

Is equivalent to

`filter(propSatisfies(includes(id), 'foo'))`

`omit`

also takes a list of strings, not a string directly
Please ignore Def and Omit. They are not Ramda functions.

Hello! ramda is intensely rad. In order to get more fluent with it I am doing some old CodeWars favorites with it. I've come to the problem I always come to where I don't know the word for what I'm trying to do, which is remove a variable from the beginning and end of a function (which doesn't really describe it)

```
// from a codewars kata, don't read if you don't want
// spoilers for the Matrix Determinant
const { drop, ifElse, propEq, path, prop, negate, identity, __, call, pipe, modulo, always, remove, slice, map, reduce, addIndex, converge, inc, concat, multiply, add } = require('ramda');
const odd = x => x & 1;
const removeCol = pipe(remove(__, 1), map)
const makeReducer = matrix => (sum, c, idx) => pipe(
drop(1), // drop the first row of matrix
removeCol(idx),// remove this column from each row
determinant, // take determinant of submatrix
multiply(c), // multiply by value in this cell
ifElse(always(odd(idx, 2)), negate, identity), //negate every other
add(sum) // add to sum
)(matrix);
const determinant = ifElse(
propEq('length', 1),
path([ 0, 0 ]),
converge(call, [pipe(makeReducer, addIndex(reduce)(__, 0)), prop(0)])
)
// by way of comparison, this is the old function I replaced.
const wackDeterminant = m => m[1] ? m[0].reduce(
(p,c,j) => p + Math.pow(-1, j) * c * wackDeterminant(m.slice(1).map(
v => v.slice(0, j).concat(v.slice(j + 1)
))
), 0) : m[0][0];
```

since

`makeReducer`

takes `matrix`

(a square nested array) and then calls the result of `pipe`

with it, I'd think I could just remove it, but I can't for a reason I kind of understand but can't really articulate.
it's because

`makeReducer`

returns another function (waiting for sum, c, idx)
right, that.

`const makeReducer = matrix => pipe( ... )(matrix)`

is the same as `const makeReducer => pipe( ... )`

it's called point-free

hmmm whenever I try that second one it doesn't actually work. I need to do more intermediate steps to see what's happening, but I end up with functions not numbers

Swap the order of (sum, c, idx) and matrix

it won't work in your situation because of the

`(sum, c, idx)`

in there
Then you can remove the explicit reference ot matrix as a parameter

@Bradcomp swap them in the order of the arrows? so

`(sum, c, idx) => matrix => pipe(…)(matrix)`

@lax4mike tyvm for this cool new word! will dive in post haste.

also if you'd like me to make a codepen I'm happy to if that makes anything easier

be careful with coding in the pointfree style, sometimes it makes your code more concise, sometimes it makes it harder to follow. It's a judgement call

Yes!

`(sum, c, idx) => matrix => pipe(…)(matrix)`

can be reduced to `(sum, c, idx) => pipe(…)`

right, roger. So is there actually a term for what I'm trying to do beyond just pointfree? Like what I'm trying to do to produce the reducer function?

@Bradcomp but it can't every time I try. Let me whip up a codepen to make it easier to see