I'm trying to unit-test a library with which a user can define methods
on the library's multi-function to change its behavior. So I need to
be able to define lexically-scoped methods in each test. Is it
possible to use let to create a lexically-scoped method?
The problems I'm encountering are tha
On Nov 18, 6:48 pm, samppi <[EMAIL PROTECTED]> wrote:
> I'm trying to unit-test a library with which a user can define methods
> on the library's multi-function to change its behavior. So I need to
> be able to define lexically-scoped methods in each test. Is it
> possible to use let to create a
Yes, but I meant creating methods rather than regular functions, in a
lexical scope. Is it possible to create methods using fn?
On Nov 18, 10:47 pm, Allen Rohner <[EMAIL PROTECTED]> wrote:
> On Nov 18, 6:48 pm, samppi <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to unit-test a library with which a
On Nov 18, 11:53 pm, samppi <[EMAIL PROTECTED]> wrote:
> Yes, but I meant creating methods rather than regular functions, in a
> lexical scope. Is it possible to create methods using fn?
>
What do you mean by methods as distinct from functions? In clojure
there are only functions. Are you referr
Hi,
On 19 Nov., 06:53, samppi <[EMAIL PROTECTED]> wrote:
> Yes, but I meant creating methods rather than regular functions, in a
> lexical scope. Is it possible to create methods using fn?
(ns foo)
(defmulti bar ...)
(ns foo.test)
(defmethod foo/bar ...)
One can also use the MultiFn Java met
In Clojure, specific implementations of a Clojure multimethod are
called methods.
Cheers,
Stuart
> What do you mean by methods as distinct from functions? In clojure
> there are only functions. Are you referring to Java methods?
--~--~-~--~~~---~--~~
You recei
You could write a with-method macro that adds a method to a
multifunction, and then removes it at the end of the test. It would be
dynamically scoped, but that should be good enough for test setup/
teardown.
Stuart
>
> I'm trying to unit-test a library with which a user can define methods
>
Thanks to everyone who answered. The custom macro seems to be the way
to go for a local method. I'm no good at macros, though, so I suppose
I have to confront them and figure them out now. :)
On Nov 19, 5:20 am, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> You could write a with-method macro that