ham-fisted.function

Helpers for working with java.util.function package objects.

->bi-function

(->bi-function cljfn)

Convert an object to a java.util.BiFunction. Object can either already be a bi-function or an IFn to be invoked with 2 arguments.

->function

(->function cljfn)

Convert an object to a java Function. Object can either already be a Function or an IFn to be invoked.

->long-predicate

(->long-predicate f)

bi-consumer

macro

(bi-consumer arg1 arg2 & code)

bi-function

macro

(bi-function arg1 arg2 & code)

Create an implementation of java.util.function.BiFunction.

binary-operator

macro

(binary-operator arg1 arg2 & code)

Create an implementation of java.util.function.BinaryOperator

binary-predicate

macro

(binary-predicate xvar yvar code)

Create a java.util.function.BiPredicate

binary-predicate-or-null

(binary-predicate-or-null f)

If f is null, return null. Else return f as a java.util.function.BiPredicate.

comp-nan-first

A comparator that sorts null, NAN first, natural order

comp-nan-last

A comparator that sorts null, NAN last, natural order

consumer

macro

(consumer varname & code)

Create an instance of a java.util.function.Consumer

double->long

macro

(double->long varname & code)

Create a function that receives a double and returns a long

double->obj

macro

(double->obj varname & code)

double-binary-operator

macro

(double-binary-operator lvar rvar & code)

Create a binary operator that is specialized for double values. Useful to speed up operations such as sorting or summation.

double-consumer

macro

(double-consumer varname & code)

Create an instance of a java.util.function.DoubleConsumer

double-predicate

macro

(double-predicate varname & code)

Create an implementation of java.util.Function.DoublePredicate

double-unary-operator

macro

(double-unary-operator varname & code)

Create an implementation of java.util.function.DoubleUnaryOperator

function

macro

(function arg & code)

Create a java.util.function.Function

long->double

macro

(long->double varname & code)

Create a function that receives a long and returns a double

long->obj

macro

(long->obj varname & code)

Create a function that receives a primitive long and returns an object.

long-binary-operator

macro

(long-binary-operator lvar rvar & code)

Create a binary operator that is specialized for long values. Useful to speed up operations such as sorting or summation.

long-consumer

macro

(long-consumer varname & code)

Create an instance of a java.util.function.LongConsumer

long-predicate

macro

(long-predicate varname & code)

Create an implementation of java.util.Function.LongPredicate

long-unary-operator

macro

(long-unary-operator varname & code)

Create an implementation of java.util.function.LongUnaryOperator

make-comparator

macro

(make-comparator lhsvar rhsvar & code)

Make a java comparator.

make-double-comparator

macro

(make-double-comparator lhsvar rhsvar & code)

Make a comparator that gets passed two double arguments.

make-long-comparator

macro

(make-long-comparator lhsvar rhsvar & code)

Make a comparator that gets passed two long arguments.

obj->double

macro

(obj->double)(obj->double varname & code)

Create a function that converts objects to doubles

obj->long

macro

(obj->long)(obj->long varname & code)

Create a function that converts objects to longs

predicate

macro

(predicate varname & code)

Create an implementation of java.util.Function.Predicate

rcomp

A reverse comparator that sorts in descending order

unary-operator

macro

(unary-operator varname & code)

Create an implementation of java.util.function.UnaryOperator