[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] functors

From: Felix
Subject: Re: [Chicken-hackers] functors
Date: Thu, 24 Mar 2011 09:11:25 -0400 (EDT)

> One question: right now it is necessary to define an intermediary module
> and then another one to actually instantiate the functor like. in this
> example from the documentation:
>   (module nums (multiply)
>     (import scheme)
>     (define (multiply x y) (* x y)))
>   (module number-squarer = (squaring-functor nums))
> Maybe I didn't understand it all correctly but is there syntax for
> folding that into one definition? E.g. something like this:
> (module number-squarer ((instantiates: squaring-functor))
>   (import scheme)
>   (define (multiply x y) (* x y)))

"squaring-functor" takes any number of arguments, so your example
would probably an abbreviation for the common case of instantiating
a functor with a single argument module and providing the body of
that argument at the same step. Interesting! I'll ponder this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]