unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* equal? on arrays
@ 2006-03-07 20:57 Kevin Ryde
  2006-03-25 19:47 ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2006-03-07 20:57 UTC (permalink / raw)


What can be said in the manual about `equal?' on arrays these days?
Can vectors and 1-dim arrays be compared with equal now?  Is it still
the case that all shared arrays have to be compared with
`array-equal?' ?


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: equal? on arrays
  2006-03-07 20:57 equal? on arrays Kevin Ryde
@ 2006-03-25 19:47 ` Marius Vollmer
  2006-03-29  0:42   ` Kevin Ryde
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Vollmer @ 2006-03-25 19:47 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> What can be said in the manual about `equal?' on arrays these days?
> Can vectors and 1-dim arrays be compared with equal now?  Is it still
> the case that all shared arrays have to be compared with
> `array-equal?' ?

It should clearly be possible to use equal? with all kinds of arrays.
If this isn't the case, we would need to fix.  (I hope that the fix is
as easy as documenting the bug in this case...)

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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: equal? on arrays
  2006-03-25 19:47 ` Marius Vollmer
@ 2006-03-29  0:42   ` Kevin Ryde
  2006-05-29 21:15     ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2006-03-29  0:42 UTC (permalink / raw)
  Cc: guile-devel

Marius Vollmer <mvo@zagadka.de> 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.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: equal? on arrays
  2006-03-29  0:42   ` Kevin Ryde
@ 2006-05-29 21:15     ` Marius Vollmer
  0 siblings, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2006-05-29 21:15 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> Marius Vollmer <mvo@zagadka.de> 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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-05-29 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-07 20:57 equal? on arrays Kevin Ryde
2006-03-25 19:47 ` Marius Vollmer
2006-03-29  0:42   ` Kevin Ryde
2006-05-29 21:15     ` Marius Vollmer

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).