Evaluation in calling scope?

Even if you write the most inefficient code possible using higher order functions, it is very likely that you would be orders of magnitude faster than anything involving eval.

That said, if you are worried about fusing, why don’t you just combine the functions on atoms, and broadcast that? Eg

combine(combiner, f1, f2) = (x, y) -> ((x, y) -> combiner(f1(x), f2(y))).(x, y)
f = combine(+, sqrt, exp)
f(1:3, 4:6)

That said, I would just work with functions that operate on atoms and do the broadcasting in the last step outside. But I have to admit that I lost track of what the problem is.

9 Likes