Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (all-labelled-subtrees t)
- (match t
- [`(,label . ,children) (cond
- [(and (not (list? label)) (empty? children)) '()]
- [(list? label) (cons label (all-labelled-subtrees t))]
- [else (all-labelled-subtrees t)])]
- [_ (error "no u")]))
- (define (helper t)
- (list (all-labelled-subtrees `(,t))))
- (define t '(1 2 3 (4 5 (6 7 (9)))))
Add Comment
Please, Sign In to add comment