From: "Daniel Llorens del Río" <daniel.llorensdelrio@epfl.ch>
Subject: make-shared-array
Date: Thu, 28 Sep 2006 11:04:28 +0200 [thread overview]
Message-ID: <6F5D39A8-11BC-41D3-A206-9BD6C28C5330@epfl.ch> (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
next reply other threads:[~2006-09-28 9:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 9:04 Daniel Llorens del Río [this message]
2006-09-29 0:42 ` make-shared-array Kevin Ryde
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=6F5D39A8-11BC-41D3-A206-9BD6C28C5330@epfl.ch \
--to=daniel.llorensdelrio@epfl.ch \
/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).