guile-user
[Top][All Lists]
Advanced

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

Re: overload a procedure


From: Vivien Kraus
Subject: Re: overload a procedure
Date: Sun, 19 Feb 2023 18:52:14 +0100
User-agent: Evolution 3.46.0

Hi Damien,

Le dimanche 19 février 2023 à 18:45 +0100, Damien Mattei a écrit :
> ok now i come to the scheme problem implementing the two solutions;
> in
> scheme i can not use types so i use type predicates (number? verctor?
> string? list?....)to identify the good function depending of the
> parameters
> types find with the predicates.
> i tried with macro and recursive function with this solution:
> 
> example of use::
> (overload + add-vect-vect vector? vector?)

Did you try GOOPS? It provides that kind of functionality.

(use-modules (oop goops) (srfi srfi-43))
(define-method (+ (a <vector>) (b <vector>)) (vector-append a b))
(+ #(1 2 3) #(4 5))

Vivien



reply via email to

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