* make-shared-array
@ 2006-09-28 9:04 Daniel Llorens del Río
2006-09-29 0:42 ` make-shared-array Kevin Ryde
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Llorens del Río @ 2006-09-28 9:04 UTC (permalink / raw)
Hello,
I've found a typo in the documentation and a bug in libguile/unif.c/
scm_make_shared_array().
The last example says:
(make-shared-array #1(a b c d e f g h i j k l)
(lambda (i) (* i 3))
4)
The 2nd argument should be (lambda (i) (list (* i 3))).
Anyway this fails with an 'out of bounds' error in guile 1.8.0. The
reason is that SCM_I_ARRAYP(vector) is false (*) and SCM_I_ARRAY_BASE
(vector) gives garbage, but scm_make_shared_array() uses it anyway.
Here is a patch against guile-1.8.0/libguile/unif.c.
--------------------------
873c873,874
< if (SCM_I_ARRAYP (oldra))
---
> const int oldra_is_array = SCM_I_ARRAYP(oldra);
> if (oldra_is_array)
912c913
< SCM_I_ARRAY_BASE (ra) = new_min = new_max = i + SCM_I_ARRAY_BASE
(oldra);
---
> SCM_I_ARRAY_BASE (ra) = new_min = new_max = i +
(oldra_is_array ? SCM_I_ARRAY_BASE (oldra) : 0);
--------------------------
(*) but they give #t for array?.
Regards,
Daniel.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-29 0:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-28 9:04 make-shared-array Daniel Llorens del Río
2006-09-29 0:42 ` make-shared-array Kevin Ryde
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).