unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Vivien Kraus <vivien@planete-kraus.eu>
To: Damien Mattei <damien.mattei@gmail.com>, guile-user <guile-user@gnu.org>
Subject: Re: overload a procedure
Date: Sun, 19 Feb 2023 18:52:14 +0100	[thread overview]
Message-ID: <cc07622b57a50ecaf2035245261e5f2657ba7bd6.camel@planete-kraus.eu> (raw)
In-Reply-To: <CADEOadekv8YzZ5ismvbB8qi7ZXbd8bFxr_-oHDxrOM6P0xPu9w@mail.gmail.com>

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	other threads:[~2023-02-19 17:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19 17:45 overload a procedure Damien Mattei
2023-02-19 17:52 ` Vivien Kraus [this message]
2023-02-19 22:07   ` 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=cc07622b57a50ecaf2035245261e5f2657ba7bd6.camel@planete-kraus.eu \
    --to=vivien@planete-kraus.eu \
    --cc=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).