Hi Andreas,

I’m all for your suggestion.

Andreas Rottmann <a.rottm...@gmx.at> writes:

> +  (define-syntax define-fxop*
> +    (syntax-rules ()
> +      ((_ name op)
> +       (define name
> +      (case-lambda
> +        ((x y)
> +         (assert-fixnum x y)
> +         (op x y))
> +        (args
> +         (assert-fixnums args)
> +         (apply op args)))))))
> +
> +  (define-fxop* fx=? =)

How about making something like this (untested):

  (define-syntax define-fxop*
    (syntax-rules ()
      ((_ name op)
       (define-syntax name
         (lambda (s)
           (syntax-case s ()
             ((_ x y)
              #'(begin
                  (assert-fixnum x y)
                  (op x y)))
             ((_ args ...)
              #'(apply op args))
             (_ #'op)))))))

This way, there’d be no procedure call involved and ‘=’, ‘+’, etc. would
use the corresponding instruction in the base case.

Thanks,
Ludo’.


Reply via email to