Advertisement
Guest User

Untitled

a guest
Dec 9th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.47 KB | None | 0 0
  1. (define (list->pnp-tree los)
  2.   (cond
  3.     [(empty? los) empty]
  4.     [(and (list? (third los))(list? (second los)))
  5.      (make-pnp-tree (first los) (list->pnp-tree (second los)) (list->pnp-tree (third los)))]
  6.     [(list? (second los)) (make-pnp-tree (first los) (list->pnp-tree (second los)) (third los))]
  7.     [(list? (third los)) (make-pnp-tree (first los) (second los) (list->pnp-tree (third los)))]
  8.     [else (make-pnp-tree (first los) (second los) (third los))]
  9.     )
  10.   )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement