compile_value fix

* src/pf/codegen.lua: Fix compile_value for subexpressions.
Hoist length checks

* src/pf/expand.lua: Add a pass to hoist length-checking predicates to
  as early as possible.