Make arg/3 generate values on backtracking as well

Also limited unnecessary deep dereferencing in functor/3 and
atom_chars/2.
Add BIP atom_codes/2
Optimise length/2

Also change name of make_vars/2 to make_var_list/2.
merge