core tetra: code generation for curryN# and applyN# primops