(.using [library [lux {"-" left right} [abstract [equivalence {"+" Equivalence}] [hash {"+" Hash}]]]]) (template [] [(def: .public ( [left right]) (All (_ left right) (-> [left right] )) )] [left] [right] ) ... https://en.wikipedia.org/wiki/Currying (def: .public (curried f) (All (_ a b c) (-> (-> [a b] c) (-> a b c))) (function (_ x y) (f [x y]))) (def: .public (uncurried f) (All (_ a b c) (-> (-> a b c) (-> [a b] c))) (function (_ xy) (let [[x y] xy] (f x y)))) (def: .public (swapped [left right]) (All (_ left right) (-> [left right] [right left])) [right left]) (def: .public (then f g) (All (_ a b c d) (-> (-> a c) (-> b d) (-> [a b] [c d]))) (function (_ [x y]) [(f x) (g y)])) (def: .public (forked f g) (All (_ a l r) (-> (-> a l) (-> a r) (-> a [l r]))) (function (_ x) [(f x) (g x)])) (implementation: .public (equivalence left right) (All (_ l r) (-> (Equivalence l) (Equivalence r) (Equivalence [l r]))) (def: (= [rl rr] [sl sr]) (and (# left = rl sl) (# right = rr sr)))) (def: .public (hash left right) (All (_ l r) (-> (Hash l) (Hash r) (Hash [l r]))) (implementation (def: equivalence (..equivalence (# left equivalence) (# right equivalence))) (def: (hash [leftV rightV]) ("lux i64 +" (# left hash leftV) (# right hash rightV)))))