From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Wedekind Newsgroups: gmane.lisp.guile.user Subject: Re: GOOPS with variable number of arguments Date: Sat, 28 Nov 2015 22:24:01 +0000 (GMT) Message-ID: References: <87r3jbxbp7.fsf@fencepost.gnu.org> Reply-To: Jan Wedekind NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: ger.gmane.org 1448749470 8910 80.91.229.3 (28 Nov 2015 22:24:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Nov 2015 22:24:30 +0000 (UTC) Cc: guile-user@gnu.org To: David Kastrup Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Nov 28 23:24:15 2015 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a2nuf-0001Sx-JW for guile-user@m.gmane.org; Sat, 28 Nov 2015 23:24:13 +0100 Original-Received: from localhost ([::1]:33997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2nuj-00017H-3S for guile-user@m.gmane.org; Sat, 28 Nov 2015 17:24:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2nua-00016x-N1 for guile-user@gnu.org; Sat, 28 Nov 2015 17:24:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2nua-00054g-10 for guile-user@gnu.org; Sat, 28 Nov 2015 17:24:08 -0500 Original-Received: from basicbox4.server-home.net ([195.137.212.26]:52365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2nuV-00053Y-9T; Sat, 28 Nov 2015 17:24:03 -0500 Original-Received: from wedemob.default (unknown [2.27.251.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by basicbox4.server-home.net (Postfix) with ESMTPSA id DB08D1530663; Sat, 28 Nov 2015 23:24:01 +0100 (CET) X-X-Sender: jan@wedemob In-Reply-To: <87r3jbxbp7.fsf@fencepost.gnu.org> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 195.137.212.26 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12203 Archived-At: Ok, thanks. I'll use that solution. On Sat, 28 Nov 2015, David Kastrup wrote: > Jan Wedekind writes: > >> 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 ) (b )) (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 ) (b )) (string-append a b)) >> (test "a" "b" "c") >> ; "abc" >> >> Please let me know if there is a solution. > >