Add WRAP function

See http://issue.cc/r3/2119 for details.