robrix / Prelude

Swift µframework of simple functional programming tools
MIT License
409 stars 26 forks source link

Optional conjunction #28

Closed robrix closed 9 years ago

robrix commented 9 years ago

Conjunction of Optional<T> with the &&& operator, analogous with fanout over Haskell’s Arrows.

(x &&& y) // == (x, y), iff x and y are non-nil, nil otherwise

This operator is the subject of a blog post I wrote, with one minor adjustment: the version herein is short-circuiting, a la &&.