From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 031A43858281 for ; Sat, 18 Nov 2023 11:15:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 031A43858281 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 031A43858281 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700306102; cv=none; b=ecOcylp4tDlkVToa2ubIchMK/yWyVt4C8/vNaHlru3OgTC3OqUw79q6jNbM6+oD2V3Cbn1bgg8hOBT7C85kwlBS4FxFabd0I0WKp8h11tBLas7xaofsaxmSri9U8tIZaQUYTm0/THEpW40KmcPphUCsLf2AvSXYHTZ2gM1QlFRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700306102; c=relaxed/simple; bh=0yPn1fQaKFhfbEG4ymEwhzINc21iJZEHkGjTmLWhSDs=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=XIJkcHN2c8ugC4TX+vVWHsDs71/YhbxfeGcsODIYYlkfkbLXmXytehWj+zxgskHkiDNmPkKUhsr3WrxvTpAuIdDu4Sf/LpFOKMoLSVF1ASESIjWd9lMfACdtkjO7erCzfn+WPMTWujS8OJjWtAByZk1umW/6ubhUE5MFbquWGdE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-547e7de7b6fso5415735a12.0 for ; Sat, 18 Nov 2023 03:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700306098; x=1700910898; darn=sourceware.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=le07/Zu9xvcKPW6wk9MWW3FRKB/vAybGrxnPhuh0Yj4=; b=lsNy54jGuTsTYVH89MfqVH0IGYfLxvTqPWQnsA43l2vznRggN4M4YF4DzV6Qr/jyqP kv05QmmbhBCmaYuTcx99+Mg1Eyy3ndm3dAD3u1Y6M0lN69j/UYvVAgVaJiP+hXej4/wZ yl+GQS1Wm48/yHpP/qGHWBcrGT+qX4V+FGIs/cDiKPoewESqtNd/rK0owGg6ebPfTnoN GDvXvWZrmX/qSZed7YdWuvrp/HOke5Gdx3TpKifUXVGX575TlssZc5sXwrF7GBiopVmf mdwakuqybDyGx6s5fWxDwf9Sl/GXltgOSgvltGVj6bNnRmumG7nWmHL+eDvGoyzC55m8 Ctmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700306098; x=1700910898; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=le07/Zu9xvcKPW6wk9MWW3FRKB/vAybGrxnPhuh0Yj4=; b=iOo9acRxP1qP23xlEdyfrgimwVpjmBY25JdXMzUShBpF5IM0yNZSoaYcNxLZTk3bRY o9B58pPDaj8lYs2qqvD0OUsDwew7zf3ETB1yMZYbVzSyf82AQqhWMT7SamnsaGm62utJ jWxuc4OGxOrrTqV1/tmfUdob33mPMeapjSSf6NPUYgD7DPKCG+NdSWJz87CkncDiwuUD upgIfdm2ci57ixY/dMAhvc220QzbA3/odgSMvQC8By/1O4uwtF83qlx0w5Q19DxGe77a DH6ivzw0dbprk8EFJ6UPmzSFR4K27BcpHFWUrkLU4t5jCPGxLGYwW1fWhuuGCoHFBZFn 4OAA== X-Gm-Message-State: AOJu0YzJHE4esqQ4CxqNMiP1bciBxStAmfGMv3RLScBo8aIqI43b85Uk iuSTp5YnYqDw5oAWRSBlAuXuzCW82eZsnevNScVu1Nlk8xSdGA== X-Google-Smtp-Source: AGHT+IEC9hcTJEF0Njex02oxtLY0rNRzWC+RVENS7Pk5pqAChI5k27tiEHiQMmBHz24tVIMh77p6viVnhSx97x6zbDc= X-Received: by 2002:aa7:d607:0:b0:543:5144:1779 with SMTP id c7-20020aa7d607000000b0054351441779mr7172556edr.11.1700306098020; Sat, 18 Nov 2023 03:14:58 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Damien Mattei Date: Sat, 18 Nov 2023 12:14:46 +0100 Message-ID: Subject: Re: n arity with method To: kawa mailing list Content-Type: multipart/alternative; boundary="000000000000fb72d8060a6b5c0a" X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000fb72d8060a6b5c0a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable seems there is some difference in 'load' and 'import' ,the same program can run with 'load' and not with 'import' about the overloading of n-arity operators i find a solution in 'define-method' : (define =E2=8B=85 (make-procedure method: (lambda (x ::number y ::number) (= * x y)) method: (lambda (x ::matrix y ::matrix) (multiply-matrix-matrix x y)) method: (lambda (x ::matrix y ::vector) (multiply-matrix-vector x y)) method: (lambda lyst (apply * lyst)))) (insert-operator! * =E2=8B=85) kawa -d classes -Dkawa.import.path=3D".:/Users/mattei/Scheme-PLUS-for-Kawa:./kawa" -C exo_retropropagationNhidden_layers_matrix_v2_by_vectors4kawa_classes.scm i hoped to have a speed up by compiling the kawa code in .class files but it is the same , i suppose that 'load' compile the code , ad he does it with more easyness than 'require' , with 'load' the overloading features of Scheme+ worked fine , not with 'require' On Thu, Nov 16, 2023 at 11:53=E2=80=AFPM Damien Mattei wrote: > (import (rename (scheme base) (* orig*))) > > (define * (make-procedure method: (lambda (x ::number y ::number) (orig* x > y)) > method: (lambda (x ::matrix y ::matrix) (multiply-matrix-matrix x y)) > method: (lambda (x ::matrix y ::vector) (multiply-matrix-vector x y)))) > > is there a way to still have * a n-arity operator with typed methods ? > because now i have this error: > (* 2 3 4) > Argument (null) has wrong type > at gnu.mapping.CallContext.matchError(CallContext.java:185) > at gnu.expr.GenericProc.applyToConsumerGP(GenericProc.java:132) > at gnu.kawa.functions.ApplyToArgs.applyToConsumerA2A(ApplyToArgs.java:132) > at gnu.mapping.CallContext.runUntilDone(CallContext.java:586) > at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:343) > at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) > at kawa.Shell.run(Shell.java:289) > at kawa.Shell.run(Shell.java:196) > at kawa.Shell.run(Shell.java:183) > at kawa.repl.processArgs(repl.java:724) > at kawa.repl.main(repl.java:830) > the problem is that * is no more n-arity operator now > > Damien > > anyway there is perheaps a possibility of using a variable number of args > but i did not think it this evening.... perheaps tomorrow... > --000000000000fb72d8060a6b5c0a--