OFFSET
0,40
COMMENTS
LINKS
Antti Karttunen, Gatomorphisms
PROG
(Scheme-function showing the essential idea. For the full source, follow the "Catalan bijections" link.)
(define (ZigzagTree2BinTree_if_possible gt) (call-with-current-continuation (lambda (e) (let recurse ((gt gt)) (cond ((equal? gt '(() . ())) (list)) ((not (pair? gt)) (e '())) (else (cons (recurse (car gt)) (recurse (cdr gt)))))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 13 2003
STATUS
approved