程序代写代做代考 DrRacket Rewrite in R5RS environment in DRRACKET
Rewrite in R5RS environment in DRRACKET
Rewrite by let,let*,letrec,
改写成let,let*,letrec形式即可,最好能尝试letrec格式。谢谢!
(define combine
(lambda (list1)
(cond
((null? list1) ‘())
((pair? list1) (append(combine(car list1)) (combine(cdr list1))))
(else (list list1))
)))
(define spell-checker
(lambda (hflist word bitvec)
(if (null? hflist)
‘()
(combine (list (gen-checklist ((car hflist) word) bitvec) (spell-checker (cdr hflist) word bitvec)))
)
))
(define gen-checklist
(lambda (key bitvec)
(if (null? bitvec)
(list 0)
(if (= key (car bitvec))
(list 1)
(gen-checklist key (cdr bitvec))
)
)
))