From: Damien Mattei <damien.mattei@gmail.com>
To: kawa mailing list <kawa@sourceware.org>
Subject: n arity with method
Date: Thu, 16 Nov 2023 23:53:49 +0100 [thread overview]
Message-ID: <CADEOadeW7LD03M2pUhSMpVV0M9EMErcYYkrM5j8uOhWrT-HZ-g@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]
(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...
next reply other threads:[~2023-11-16 22:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 22:53 Damien Mattei [this message]
2023-11-18 11:14 ` Damien Mattei
2023-11-19 7:23 ` Damien Mattei
2023-11-19 17:50 ` Per Bothner
2023-11-20 13:51 ` Damien Mattei
2023-11-21 8:48 ` Damien Mattei
2023-11-22 10:03 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADEOadeW7LD03M2pUhSMpVV0M9EMErcYYkrM5j8uOhWrT-HZ-g@mail.gmail.com \
--to=damien.mattei@gmail.com \
--cc=kawa@sourceware.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).