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
Short closures would be nice here: Pipe::switch(fn(int $maxAge) => Gen::range(1, $maxAge))
Maybe next year. :-)
I have a partial function application function that could work: Pipe::switch(Func::apply([Gen::class, 'range'], 1))
Still not the smoothest, but no function definition.
Not sure how often currying would be needed with range() though. It wasn't the most practical of examples.
Neat little package. After a skim of the examples, I immediately thought that currying would be neat. Like:
BEFORE:
AFTER:
The only problem with this is that it's not possible to encode optional params. Perhaps explicitly have two methods, and take the step first?
Pipe::switch(Gen::rangeWithStep(3)(1))
The text was updated successfully, but these errors were encountered: