Skip to content

Commit

Permalink
Quaternary uncurrying.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Apr 3, 2015
1 parent 90f24e5 commit 6d70211
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Prelude/Curry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ public func uncurry<T, U, V>(f: T -> U -> V) -> (T, U) -> V {
public func uncurry<T, U, V, W>(f: T -> U -> V -> W) -> (T, U, V) -> W {
return { f($0)($1)($2) }
}

/// Uncurries a curried quaternary function `f`, producing a function which can be applied to a tuple.
public func uncurry<T, U, V, W, X>(f: T -> U -> V -> W -> X) -> (T, U, V, W) -> X {
return { f($0)($1)($2)($3) }
}

0 comments on commit 6d70211

Please sign in to comment.