Thanks a lot Dinko!


On Wed, Aug 19, 2015 at 11:43 AM, Dinko Srkoč <dinko.srkoc@gmail.com> wrote:
    class LogicallyChallenged {
        static Closure and(Closure left, Closure right) {
            { a, b -> left(a, b) && right(a, b) }
        }

        static Closure or(Closure left, Closure right) {
            { a, b -> left(a, b) || right(a, b) }
        }
    }

    def gt = { a, b -> a > b },
        eq = { a, b -> a == b },
        lt = { a, b -> a < b }

    def equal = use (LogicallyChallenged) {
        (gt | eq) & (lt | eq)
    }

    assert equal(1, 1)
    assert equal('a', 'a')
    assert !equal(1, 2)
    assert !equal('a', 'b')