Convert tree to list
eharetea

Convert a tree to a list.

Convert a tree to a list.

Date Created:Friday October 03rd, 2008 06:20 PM
Date Modified:Friday October 03rd, 2008 06:21 PM

(define datum car)

(define children cdr)

(define (listify-tree tree)
    (cons (datum tree) (listify-tree-map (children tree))))

(define (listify-tree-map children)
    (if (null? children)
        '()
        (append
          (listify-tree (car children))
          (list-tree-map (cdr children))
        )
    )
)



Downloads:
Download: listify-tree.scm 334 B

Please login or Click Here to register for downloads
Creative Commons License
Convert tree to list by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com