MB-100: extracted letrec into misc.erl

Change-Id: If9765885bca09bcf47e0e1d661f6cabb0d35758f
Reviewed-on: http://review.couchbase.org/24064
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>