Rewrite in R5RS environment in DRRACKET
Rewrite by let,let*,letrec,
letlet*letrecletrec
(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-checklistkey (cdr bitvec))
)
)
))
Reviews
There are no reviews yet.