From: Damien Mattei <damien.mattei@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: Re: overloading an existing operator in Guile
Date: Tue, 3 Oct 2023 20:24:34 +0200 [thread overview]
Message-ID: <CADEOadfewsLZfVGmBv=P2UHgJzWRWsdna7SVOiA2d95GhjPcbg@mail.gmail.com> (raw)
In-Reply-To: <CADEOadcwyv_aHor-LCExWpr15pGM7LJ6YzCnNL30120hKGJi=g@mail.gmail.com>
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
next prev parent reply other threads:[~2023-10-03 18:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 9:13 overloading an existing operator in Guile Damien Mattei
2023-10-03 9:19 ` Jean Abou Samra
2023-10-03 10:33 ` Damien Mattei
2023-10-03 18:24 ` Damien Mattei [this message]
2023-10-03 18:34 ` Maxime Devos
2023-10-03 18:41 ` Jean Abou Samra
2023-10-03 19:01 ` Damien Mattei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADEOadfewsLZfVGmBv=P2UHgJzWRWsdna7SVOiA2d95GhjPcbg@mail.gmail.com' \
--to=damien.mattei@gmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).