Hello, > First, thank you for your detailed answer! Welcome > So what is the right approach when I'm implementing textbook data > structures (rather than want to use the given ones, for learning > reasons) and want to implement a set. On this set, I want to write a > method "closure" that computes all the elements of the set given a > ... I won't have time to help you to design the all thing, but i can review small and complete (no ...) code snipset. The code below is incomplete. > ; = > (define-module (sets set) > #:use-module (oop goops) > #:export ( add ... closure)) > > (define-class ()) > > (define-generic add) > ... > > (define-method (closure (set ) (function )) > ... contains? ... add ... ) this is indeed not a very good design, imo: the fact that your is an 'empty' class, and with no applicable methods for the all the methods it calls in closure, are the symptoms, imo, that this is not a good design > ; = > (define-module (sets red-black-tree) > #:use-module (oop goops) > #:use-module (sets set) > #:export ()) > > (define-class ()) > > (define-method (add (tree )) > ...) I can only give an opinion, and it is only an opinion, if you provide full code snipset: and your add method lacks an argument to add :) > So I could move the add, etc, methods out into another module, if that > is the way to do it Nope, I did not say that, I did say that if you want to manually define generic functions, then do it in a separate module, and imports that module when necessary. Although not strictly necessary technically speaking, we generally define methods in the same module as the one where the class of its first argument (used to dispatch) is defined. Just look at some of the clutter examples (links i previous email)... > Guile will complain with "unbound variable: add". But this is a very > classes-contain-methods approach and given what you said, makes me > think that I'm doing this wrong thing. The fact that you manually define the generic function "add" gives the 'illusion' the design is good, but in fact, (add (make ) ) will fail with no applicable method, which imo, is a sign that the¬this design is not good. The fact that the GF definition is in the (sets set) module does not make the design any better. If you persist in manually defining GF, do it in another module, that all other module which needs them imports of course ... David.