fix given permutations

fix built-in functions, make functions first class values
support test functions that are eliminated from main context
remove vestigial test code

allow just lexing against the input of a file