From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: overloading an existing operator in Guile Date: Tue, 3 Oct 2023 11:13:30 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7587"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Oct 03 11:14:21 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qnbTw-0001pX-O2 for guile-user@m.gmane-mx.org; Tue, 03 Oct 2023 11:14:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnbTO-0006Or-Nz; Tue, 03 Oct 2023 05:13:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnbTN-0006Ob-3x for guile-user@gnu.org; Tue, 03 Oct 2023 05:13:45 -0400 Original-Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qnbTL-0001fF-KF for guile-user@gnu.org; Tue, 03 Oct 2023 05:13:44 -0400 Original-Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5345a3dfe3bso1012901a12.3 for ; Tue, 03 Oct 2023 02:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696324421; x=1696929221; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=SyS8FHSLfdOk9BrxLIT1GE60MAZC2/hv25I5ghJdEJ8=; b=ixCFIuLqzsbNpBjanV9y7my+eHgkMrMLyY0Px8qdZCimodtlNhTVbW+EjpFKrr7CNI k51LSKnwbXLogpjDXwBK1Q0/PZl4ttjVcaOVEiB0LtXz5jOQRrDnZFkH+eo4ssM9STbj ib2+AazxPeBS3/eDR6vJgwNJuxT5hD9gVu47gkembUsUY7fAnK6Kj3MXK5+koEfGW/J1 BmVeYtB/KUmQ+wgZCvK+N4GJeC+3nH9Fe3HG2p2BpDQ9U/k+GuESnjfZU2utfbP5kpV0 X5bznCWU6bjox6ZBEPHaW1SB3tKqcCn80+vQTGAWsVf/xXlsixoFk/xDKAq8yXztCorj CEEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696324421; x=1696929221; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SyS8FHSLfdOk9BrxLIT1GE60MAZC2/hv25I5ghJdEJ8=; b=NKZMIIjYXfP0yWM9veSZLs7dqYTp6fYyB8fIHmW1bcDjKc4dW16x9n3ASzeAFJyrK5 MIfMI79lzsb7o26luvq0ofBqBLgpQxg1PFs/bC9SNFeeGea56D5LhFgpq92d+D76MAhf /3Y9k9U4R1AZqCWCBycv/WAv/2JzMGXv18AO5jKftA242XxNmdYfDr5oA5UqMJibjYEQ yMST1gl0XWC8o+ApxVmxgm4/MrL0QzDajdjG83sG/V4UCrPRfFiayhuVQnzTbhciyOr2 O81it6iuG75lZfBFuaOWwOFQxxx2HO5qPLrLkpuMwawrbZag7zl++6PWvMarCrrVg8HF ObkQ== X-Gm-Message-State: AOJu0YxUtUERWxUV3UFD13g/yggF1I/e2xuxSTA/3ZQNLNMcGjHMN4DC iqNC5TYP/AoI2Po9xDR4acZ8LyJ3U20bezaerA+pHalXJLs= X-Google-Smtp-Source: AGHT+IHsRLKbl9DylndQ/Z8Wd5CXQFqMByjL+YjXQ+2TwNQCVutwelmjKfXY7KK/ljP8zAl810NjFXV34lWNiU85vO8= X-Received: by 2002:a05:6402:389:b0:52d:212d:78ed with SMTP id o9-20020a056402038900b0052d212d78edmr12273023edv.29.1696324421253; Tue, 03 Oct 2023 02:13:41 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=damien.mattei@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19210 Archived-At: hello, is it possible to overload an existing operator in Guile? example overload + to concatenate vectors. for example in Scheme (+ i admit) i can do : ; first stage overloading (define-overload-existing-operator +) ; second stage overloading (overload-existing-operator + vector-append (vector? vector?)) and use it like that: > (+ #(1 2 3) #(4 5 6)) '#(1 2 3 4 5 6) > (+ #(1 2 3) #(4 5) #(6 7 8 9)) '#(1 2 3 4 5 6 7 8 9) > {#(1 2) + #(3) + #(4 5 6)} '#(1 2 3 4 5 6) is it possible and how to do it using GOOPS (guile object oriented programming system) , i already did some sort of thing with new object , but not with an existing operator like + that apply to numbers only. Regards, Damien