simp.scm 550 B

12345678910111213141516171819202122
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey
  3. (define (foo x y z)
  4. (if (and (= (bitwise-and x 3) 0)
  5. (= (bitwise-and y 3) 0)
  6. (= (bitwise-and z 3) 0))
  7. (ashl (ashr x 2) 2)
  8. (ashl y (ashr z 2))))
  9. (define-local-syntax (define-primitive id nargs)
  10. (let ((args (reverse (list-tail '(z y x) (- '3 nargs)))))
  11. `(define (,id . ,args)
  12. (call-primitively ,id . ,args))))
  13. (define-primitive = 2)
  14. (define-primitive bitwise-and 2)
  15. (define-primitive ashl 2)
  16. (define-primitive ashr 2)