implemented letrec with knot tying