PasteRack.org
Paste # 41960
2018-03-12 18:11:55

Fork as a new paste.

Paste viewed 179 times.


Embed:

  1. #lang racket
  2.  
  3. (define t '(10
  4.             (5 (3 () ()) (1 () ())) (12 (14 (20 ()())(24 ()())) (16 ()()))))
  5. (define (right-tree t)
  6.   (if (null? t)
  7.       '()
  8.       (cons (car(caddr t)) (right-tree(car (caddr t))))))
  9.  
  10.  
  11. (right-tree t)

=>

caddr: contract violation

  expected: (cons/c (cons/c any/c pair?) any/c)

  given: 12