2 ms·
Except that the value of huge-p isn't known at compile time in the blog's described use-case, it's known at runtime, so constant propagation to remove the extra
by Jtsummers 5y ago
Except that the value of huge-p isn't known at compile time in the blog's described use-case, it's known at runtime, so constant propagation to remove the extra conditionals may or may not work. It depends on when those lambdas actually get compiled, doesn't it?
If they get compiled and close over huge-p one time, then the inner conditional remains and gets executed every time. Thus moving the branch outside the lambdas and returning the correct lambda based on the value of huge-p. For a single boolean this is trivial to do by hand. For n booleans and 2^n combinations, it's less trivial to do by hand, thus the macro.
EDIT: Nevermind, with what you added and rereading I get what you're talking about now.