tubular

Variadics in Scheme

Oct 26th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.32 KB | None | 0 0
  1. ; python-style equivalence chains
  2. (define (python=? left . args)
  3.   (or (null? args)
  4.       (let ((oper  (car args))
  5.             (right (cadr args)))
  6.         (and (oper left right)
  7.              (apply python=? (cdr args))))))
  8.  
  9. (python=? 4 < 5 = 5 <= 7 > 2) ;; => #t
  10. (python=? 'panic equal? 'Panic eqv? 'PANIC) ;; => #t
Advertisement
Add Comment
Please, Sign In to add comment