Finish cleanup of allowing function arguments first.

* Added (but did not export) selectby, sortpermby
* select, selectby, and sortpermby can take function arguments first
* Added basic tests