You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I make use of partial application quite a lot, especially with lodash/fp, it's handy for building ad-hoc easily testable transformers.
Would be nice to see some added here! One repo that's growing out of #82 is dt where I'm dropping all these useful functions but it would be great to have it all in one place.
so the argument order is flipped and separated into two separate function calls. This allows you to "build" a "mapper": mapper := Map(someFunc) then re-use it later: updated := mapper(list)
The text was updated successfully, but these errors were encountered:
It is also possible to use something like it as well:
// uncurry helps to use lo.Map without providing an index to iterateefuncuncurry[Tany, Rany](ffunc(T) R) func(T, int) R {
returnfunc(tT, _int) R {
returnf(t)
}
}
To transform a mapper with type func (T) R into func(T, int) R type. An example on go.dev. Please ping me if anyone wants a PR for it. Not sure it will be accepted though. Still, qute handy and could be useful in many other places in lo.
I make use of partial application quite a lot, especially with lodash/fp, it's handy for building ad-hoc easily testable transformers.
Would be nice to see some added here! One repo that's growing out of #82 is
dt
where I'm dropping all these useful functions but it would be great to have it all in one place.https://github.com/Southclaws/dt
An example of partial application would be:
so the argument order is flipped and separated into two separate function calls. This allows you to "build" a "mapper":
mapper := Map(someFunc)
then re-use it later:updated := mapper(list)
The text was updated successfully, but these errors were encountered: