Implement function threading.
[hope.git] / src / hope_fun.erl
index 96a39cd..df0d786 100644 (file)
@@ -6,6 +6,7 @@
     , compose/1  % alias for compose_right/1
     , compose_right/1
     , compose_left/1
+    , thread/2
     ]).
 
 -spec id(A) ->
@@ -41,6 +42,12 @@ compose_right(Fs) ->
 compose_left(Fs) ->
     compose_given_fold(Fs, fun lists:foldl/3).
 
+-spec thread([fun((A) -> B)], A) ->
+    B.
+thread(Fs, X) ->
+    F = compose_left(Fs),
+    F(X).
+
 
 %% ============================================================================
 
This page took 0.021731 seconds and 4 git commands to generate.