lib.pipe: Avoid creating scopes
This commit is contained in:
@@ -58,9 +58,7 @@ rec {
|
|||||||
of the next function, and the last function returns the
|
of the next function, and the last function returns the
|
||||||
final value.
|
final value.
|
||||||
*/
|
*/
|
||||||
pipe = val: functions:
|
pipe = builtins.foldl' (x: f: f x);
|
||||||
let reverseApply = x: f: f x;
|
|
||||||
in builtins.foldl' reverseApply val functions;
|
|
||||||
|
|
||||||
# note please don’t add a function like `compose = flip pipe`.
|
# note please don’t add a function like `compose = flip pipe`.
|
||||||
# This would confuse users, because the order of the functions
|
# This would confuse users, because the order of the functions
|
||||||
|
|||||||
Reference in New Issue
Block a user