pairs of predicates and transforms followed by a default transform
the value to evaluate
Whatever is returned by the result that wins
Benchmarks:
A sample cond if/else chain was used with a mixture of expressions and unary functions and iterated over. A couple of hand written if/else chains were compared. The first used lambdas to evaluate their conditions, the second just used inline code.
Benchmarking cond against hand written if/elses cond: 2 hnsecs hand written 1: 0 hnsecs hand written 2: 0 hnsecs
Takes pairs of predicates and transforms and uses the first transform that a predicate return true for.
For example in the following call:
predN can either be a unary function or an expression. transformN can be a unary, or binary function, or an expression. The unary function cannot be a string since narrow strings will be treated as values. default is treated as a transform.
All transforms must return a common type, or void. If there's a common return then a default transform must be provided. If all the transforms return void then a default is not needed.