WIP
Fix bad handling of maximum function arity.
Preliminary support for polyfit function.