Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (addword word tree)
- (define (help code tree)
- (if (empty? code) (car word)
- (if (=(car code) 0)
- (if (left tree)
- (cons (help (cdr code) (left tree)) (right tree))
- +inf.0)
- (if (right tree)
- (cons (left tree) (help (cdr code) (right tree)))
- +inf.0
- ))))
- (help (cdr word) tree))
- (define (left tree)
- (if (empty? tree) '()
- (if (not(pair? tree)) false
- (car tree))))
- (define (right tree)
- (if (empty? tree) '()
- (if (not(pair? tree)) false
- (cdr tree))))
- (define (main lst)
- (foldl addword '() lst))
- (define (decode? lst)
- (if (member +inf.0 (flatten (main lst))) false true))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement