OFFSET
0,3
COMMENTS
This Catalan bijection rotates binary trees right, if possible, otherwise applies Catalan bijection A069768.
LINKS
A. Karttunen, Gatomorphisms (with the complete Scheme source)
PROG
(Scheme) ;; Functions implementing this automorphism on list-structures:
(define (gma082350! s) (cond ((pair? s) (cond ((pair? (car s)) (robr! s)) (else (gma069768! s))))) s)
(define (robr! s) (let ((ex-cdr (cdr s))) (set-cdr! s (caar s)) (set-car! (car s) ex-cdr) (swap! (car s)) (swap! s) s))
(define (swap! s) (let ((ex-car (car s))) (set-car! s (cdr s)) (set-cdr! s ex-car) s))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 17 2003
STATUS
approved
