implemented letrec