From: Jan Wedekind <jan@wedesoft.de>
To: guile-user@gnu.org
Subject: GOOPS with variable number of arguments
Date: Fri, 27 Nov 2015 22:58:36 +0000 (GMT) [thread overview]
Message-ID: <alpine.DEB.2.11.1511272226010.5617@wedemob> (raw)
Hi,
I am trying to implement n-ary operations for different types of objects.
When specialising "+" for two arguments, it will automatically work on
more arguments.
(use-modules (oop goops) (srfi srfi-1))
(define-generic +)
(define-method (+ (a <string>) (b <string>)) (string-append a b))
(+ "a" "b" "c")
; "abc"
However I have trouble figuring out a method definition for test which
would result in the same behaviour.
(define (test . args) ...)
(define-generic test)
(define-method (test (a <string>) (b <string>)) (string-append a b))
(test "a" "b" "c")
; "abc"
Please let me know if there is a solution.
next reply other threads:[~2015-11-27 22:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 22:58 Jan Wedekind [this message]
2015-11-27 23:30 ` GOOPS with variable number of arguments David Kastrup
2015-11-28 22:24 ` Jan Wedekind
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=alpine.DEB.2.11.1511272226010.5617@wedemob \
--to=jan@wedesoft.de \
--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).