chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] functors


From: Moritz Heidkamp
Subject: Re: [Chicken-hackers] functors
Date: Thu, 24 Mar 2011 12:12:50 +0100

Hi Felix,

Felix <address@hidden> writes:
> Anyway, that's it.

functorific!

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)))

My guess is that the intermediary module would rarely be used on its own
so most of the time it would just clutter the module namespace. But I
may very well be mistaken. Also, `instantiates' is just what first came
to mind ;-)

Thanks for that cool feature, looking forward to playing with it!

Moritz



reply via email to

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