[Top][All Lists]

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

Re: equal? on arrays

From: Marius Vollmer
Subject: Re: equal? on arrays
Date: Tue, 30 May 2006 00:15:05 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Kevin Ryde <address@hidden> writes:

> Marius Vollmer <address@hidden> writes:
>> It should clearly be possible to use equal? with all kinds of arrays.
>> If this isn't the case, we would need to fix.
> Eg, picking out a diagonal with a shared array:
>     (equal? (make-shared-array #2((a b c) (d e f) (g h i))
>                                (lambda (i) (list i i))
>                                '(0 2))
>             #(a e i))
>     => #f
> but with array-equal? it's #t.
> It was this way in guile 1.6 too, but never really documented under
> equal?, unless you know or thought a shared array is not really an
> array.

The problem is that #(a e i) is a vector (scm_tc7_vector) while
make-shared-array returns a smob.

In Guile 1.6, you could not use vector-ref with a one-dimensional
array smob (but you could use array-ref with a vector).  Thus, you
could say that a one-dimensional array is not a vector and can not be
equal to it.  It also prints differently.

In Guile 1.8, you can use vector-ref with a one-dimensional array
smob, and they print identical.  Thus, they should be equal? now.

I'll fix this.

GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405

reply via email to

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