Re: Predicate generic functions
Peter 28 Jul 2021 16:50 UTC
Hello!
> I've been noodling on the generic procedures/polymorphism problem for
> a bit, but the huge discussion on this list about it has prompted me
> to make my work public.
> Check it out at
> https://github.com/laserswald/pre-srfi-generic-procedures , pull
> requests, comments, and even complaints are more than welcome! I think
> this would be a good SRFI for the CLOS style OO implementation, but I
> think we should have other SRFIs for other kinds of polymorphism.
> It's based a little bit on Clojure's multimethods, where there is an
> explicit hierarchy structure that controls resolution.
This looks nice, just like something I've been using for a while, it
works rather well (even though I'm not sure how well it can be
optimised).
Just one quick idea, maybe think about reversing the order of predicate
and name, so instead of
(define-method (elt (coll list?) idx) (list-ref coll idx))
you would have
(define-method (elt (list? coll) idx) (list-ref coll idx))
which to me reads more naturally and also is the same order as an actual
function call would be ;)t
I'll study the text und come back with more comments later ;)
Thanks for publishing this!
Greetings, Peter