Re: [racket-users] how to display all paths of a tree without repetitions

2018-08-10 Thread Robert Girault
On Sun, Aug 5, 2018 at 3:40 PM Matthias Felleisen wrote: > I“d write it like this: > > (struct tree (val left right) #:transparent) > ;; Tree = '() | (tree X Tree Tree) > > (define (printer t0) > (local (;; from-t0 : the path from t0 to t > (define (printer/acc t from-t0) >

Re: [racket-users] how to display all paths of a tree without repetitions

2018-08-05 Thread Matthias Felleisen
I“d write it like this: (struct tree (val left right) #:transparent) ;; Tree = '() | (tree X Tree Tree) (define (printer t0) (local (;; from-t0 : the path from t0 to t (define (printer/acc t from-t0) (cond [(empty? t) (map display (reverse

[racket-users] how to display all paths of a tree without repetitions

2018-08-05 Thread Robert Girault
I have this tree[1]: (tree '(game A B) (tree '(game A C) '() (tree '(game C B) '() (tree '(game B A) '() '( (tree '(game B C) '() (tree '(game C A) '() (tree '(game A B) '() '() This is how I'd like to print it out: ;; (game A B) --> (game A C) --> end ;; (game A B) --> (game A C)