|
|
|
|
|
by MarsIronPI
286 days ago
|
|
My impression is that in general the traditional approach of methods as members of a class is more verbose and less extensible than the ML/Lisp generic function approach. I know I certainly prefer generic functions when I have to design polymorphic interfaces. |
|
This is Common Lisp, which I am not an expert in:
Here's a similar program in OCaml, which I am also not an expert in, using pattern-matching functions instead of methods, and avoiding mutation: