Guest User

Untitled

a guest
Jun 23rd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. (define (all-labelled-subtrees t)
  2. (match t
  3. [`(,label . ,children) (cond
  4. [(and (not (list? label)) (empty? children)) '()]
  5. [(list? label) (cons label (all-labelled-subtrees t))]
  6. [else (all-labelled-subtrees t)])]
  7. [_ (error "no u")]))
  8.  
  9.  
  10. (define (helper t)
  11. (list (all-labelled-subtrees `(,t))))
  12.  
  13. (define t '(1 2 3 (4 5 (6 7 (9)))))
Add Comment
Please, Sign In to add comment