junkdrawer 0.1.0

A crate for all kinds of utilities.
Documentation
/// A utility function that returns the first element of a 2-tuple.
///
/// See [fst](https://hackage.haskell.org/package/base-4.21.0.0/docs/Prelude.html#g:3) from Haskell.
/// Allows easy extraction of the first element of a 2-Tuple in iterators or where ever.
pub fn fst<A, B>((fst, _snd): (A, B)) -> A {
    fst
}

/// A utility function that returns the second element of a 2-tuple.
///
/// See [snd](https://hackage.haskell.org/package/base-4.21.0.0/docs/Prelude.html#g:3) from Haskell.
/// Allows easy extraction of the second element of a 2-Tuple in iterators or where ever.
pub fn snd<A, B>((_fst, snd): (A, B)) -> B {
    snd
}

/// A utility function that reverses a 2-tuple
pub fn reverse<A, B>((fst, snd): (A, B)) -> (B, A) {
    (snd, fst)
}