guile-user
[Top][All Lists]
Advanced

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

Re: overloading an existing operator in Guile


From: Damien Mattei
Subject: Re: overloading an existing operator in Guile
Date: Tue, 3 Oct 2023 20:24:34 +0200

solution:

scheme@(guile-user)> (define-method (+ (x <vector>) (y <vector>))
(vector-append x y))
;;; <stdin>:11:46: warning: possibly unbound variable `vector-append'
scheme@(guile-user)> (use-modules (srfi srfi-43))
scheme@(guile-user)> (+ 2 3)
$3 = 5
scheme@(guile-user)> (+ #(1 2 3) #(4 5))
$4 = #(1 2 3 4 5)

scheme@(guile-user)> {#(1 2 3) + #(4 5)}
$5 = #(1 2 3 4 5)

On Tue, Oct 3, 2023 at 12:33 PM Damien Mattei <damien.mattei@gmail.com> wrote:
>
> thank you
> i understand i must overload + the usual way in <vector> class
> scheme@(guile-user)> <vector>
> $2 = #<<class> <vector> 104a6e380>
>
> about the described problem this should not be a problem because -
> <vector> as no sense in term of concatanate
>
> On Tue, Oct 3, 2023 at 11:19 AM Jean Abou Samra <jean@abou-samra.fr> wrote:
> >
> >
> >
> > Le 3 oct. 2023 à 11:14, Damien Mattei <damien.mattei@gmail.com> a écrit :
> >
> > is it possible to overload an existing operator in Guile?
> >
> >
> >
> > Yes, but it's a bit buggy. See 
> > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64508



reply via email to

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