Add defined()

This PR is for the first bullet on issue #893.

I've added the defined() function and a spec for it.