guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Introduction of fractions exposes uniform vector prototype bug


From: Kevin Ryde
Subject: Re: Introduction of fractions exposes uniform vector prototype bug
Date: Sat, 20 Dec 2003 07:38:16 +1000
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Mikael Djurfeldt <address@hidden> writes:
>
> I have no good suggestion for what to do about this, but one thing is
> certain: We can't suggest people to use 1/3 as prototype for double
> arrays (at least now without modifying scm_make_uve).

I'd be pretty inclined to make it a special case, for compatibility.

Asking people to change their code after they've followed something
the manual explicitly said is never nice.

Fractions apart from 1/3 could be left to indicate an array of
fractions, if such a thing is added in the future.

Perhaps (below),

        * unif.c (scm_make_uve): Recognise 1/3 for a dvect array of doubles,
        as specified in the manual.
        (scm_dimensions_to_uniform_array): Convert prototype 1/3 to an
        inexact, as required by scm_array_fill_x.
        (exactly_one_third): New variable.
        (scm_init_unif): Initialize it.

        * tests/unif.test: New file.

Maybe array-fill! should use scm_num2dbl the same way array-set! does,
instead of converting in scm_dimensions_to_uniform_array.

I think it'd make a lot of sense for array-fill! and array-set! to
accept the same operands.  (Irrespective of what's done or not done to
make_uve.)

Attachment: unif.c.dvect.diff
Description: Text document

Attachment: unif.test
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]