Factored out gen-args.

Doesn't seem to work quite right for binary primitives. Need to look
at this in more detail.