Change encapsulation to use functions instead of evaluation forms.

In preparation for making sb-profile use ENCAPSULATE, reducing
profiling overhead from evaluation.
sb-profile: use ENCAPSULATE to wrap functions around.

For better compatibility with generic functions, use ENCAPSULATE.

Fixes lp#309086.