unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] Fast R6RS div/mod; improved extensibility of numerics
Date: Mon, 31 Jan 2011 21:16:03 +0100	[thread overview]
Message-ID: <m3aaigygl8.fsf@unquote.localdomain> (raw)
In-Reply-To: <87vd15x9fu.fsf@yeeloong.netris.org> (Mark H. Weaver's message of "Mon, 31 Jan 2011 12:35:49 -0500")

On Mon 31 Jan 2011 18:35, Mark H Weaver <mhw@netris.org> writes:

> Andy Wingo <wingo@pobox.com> writes:
>>> The last patch might be slightly controversial.  Although it does not
>>> make `integer-expt' a generic function, nonetheless it can now
>>> exponentiate _any_ scheme object that can be multiplied using `*'.
>>
>> To me this is fine, in principle; but I wonder about causing `(expt #t
>> 0)' to produce 1.  It seems that in any case the range of the output
>> should be continuous -- i.e. if (expt <my-matrix> 1) produces a matrix,
>> and (expt <my-matrix> n) for n > 1 makes a matrix, then (expt
>> <my-matrix> 0) should also produce a matrix.  Or no?
>
> When using generic arithmetic operators, there's no way to return
> objects of the correct type in all corner cases like this.

I did apply it, but it made the test cases start to fail, because
numbers.test is loaded after ecmascript.test, and:

    scheme@(guile-user)> ,L ecmascript
    Happy hacking with ECMAScript!  To switch back, type `,L scheme'.
    ecmascript@(guile-user)> true * true;
    $1 = 1
    ecmascript@(guile-user)> ,L scheme
    Happy hacking with Scheme!  To switch back, type `,L ecmascript'.
    scheme@(guile-user)> (* #t #t)
    $2 = 1

I think that's the thing, anyway.  It just sounds really squirrelly.
Could you not extend `expt' or `integer-expt' instead?

Andy
-- 
http://wingolog.org/



  parent reply	other threads:[~2011-01-31 20:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-30 16:27 [PATCH] Fast R6RS div/mod; improved extensibility of numerics Mark H Weaver
2011-01-30 22:24 ` Andy Wingo
2011-01-30 22:55   ` Ludovic Courtès
2011-01-31  6:19     ` [PATCH] Rework the testing framework for number-theoretic division operators Mark H Weaver
2011-01-31  8:52       ` Andy Wingo
2011-01-31 17:14   ` [PATCH] Fast R6RS div/mod; improved extensibility of numerics Mark H Weaver
2011-01-31 17:35   ` Mark H Weaver
2011-01-31 19:26     ` Andy Wingo
2011-01-31 20:16     ` Andy Wingo [this message]
2011-01-31 20:30       ` Mark H Weaver
2011-01-31 20:46         ` Andy Wingo
2011-01-31 20:46       ` Mark H Weaver

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=m3aaigygl8.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.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).