On Sat, 2009-09-05 at 10:18 +0200, leppie wrote: > ----- Original Message ----- > From: "leppie" <xacc....@gmail.com> > To: "Eduardo Cavazos" <wayo.cava...@gmail.com>; > <ikarus-users@ikarus-scheme.org> > Sent: Saturday, September 05, 2009 10:03 AM > Subject: Re: [ikarus-users] Procedure arity in macros > > > >> I guess it comes down to, can a macro "eval" that 'f' so that it's a > >> procedure which can then be passed to 'procedure-arity'? > > > > > > Nope. > > > > I dont think there is a way either. > > > There is a way I think. > > You could wrap evaluate your macro inside eval. Eg > > (define (smart-curry x) > (let ((n (proc-arity x))) > (eval `(smart-curry-aux ',x ,n) (your-env)))) > > This will generate the optimized curry for proc x. > > Could this work?
I don't know. What type of object is x? What is proc-arity and smart-curry-aux? If I'm guessing correctly, I'd do that like: (define-syntax smart-curry (lambda (stx) (syntax-case stx () ((_ proc-name) (identifier? (syntax proc-name)) (with-syntax ((arity (proc-arity (syntax->datum (syntax proc-name))))) (syntax (smart-curry-aux proc-name arity))))))) -- : Derick ----------------------------------------------------------------