* vector->list
@ 2006-11-28 12:51 Szavai Gyula
2006-11-29 9:25 ` vector->list Ludovic Courtès
2006-12-01 20:09 ` vector->list Kevin Ryde
0 siblings, 2 replies; 4+ messages in thread
From: Szavai Gyula @ 2006-11-28 12:51 UTC (permalink / raw)
guile-1.8-20061126
(let ((b (make-shared-array #(1) (lambda (x) '(0)) 2)))
(list b
(vector->list b)))
==> (#(1 1) ())
--- orig/libguile/vectors.c 2006-11-28 10:15:36.354766400 +0100
+++ mod/libguile/vectors.c 2006-11-28 10:21:52.195198400 +0100
@@ -392,11 +392,11 @@
SCM res = SCM_EOL;
const SCM *data;
scm_t_array_handle handle;
- size_t i, len;
+ size_t i, j, len;
ssize_t inc;
data = scm_vector_elements (v, &handle, &len, &inc);
- for (i = len*inc; i > 0;)
+ for (i = len*inc, j = len; j > 0; --j)
{
i -= inc;
res = scm_cons (data[i], res);
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vector->list
2006-11-28 12:51 vector->list Szavai Gyula
@ 2006-11-29 9:25 ` Ludovic Courtès
2006-12-01 20:09 ` vector->list Kevin Ryde
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2006-11-29 9:25 UTC (permalink / raw)
Cc: bug-guile
Hi,
Szavai Gyula <szgyg@ludens.elte.hu> writes:
> --- orig/libguile/vectors.c 2006-11-28 10:15:36.354766400 +0100
> +++ mod/libguile/vectors.c 2006-11-28 10:21:52.195198400 +0100
> @@ -392,11 +392,11 @@
> SCM res = SCM_EOL;
> const SCM *data;
> scm_t_array_handle handle;
> - size_t i, len;
> + size_t i, j, len;
> ssize_t inc;
>
> data = scm_vector_elements (v, &handle, &len, &inc);
> - for (i = len*inc; i > 0;)
> + for (i = len*inc, j = len; j > 0; --j)
> {
> i -= inc;
> res = scm_cons (data[i], res);
I just committed the test case and a similar fix in HEAD and 1.8.
Thanks!
Ludovic.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vector->list
2006-11-28 12:51 vector->list Szavai Gyula
2006-11-29 9:25 ` vector->list Ludovic Courtès
@ 2006-12-01 20:09 ` Kevin Ryde
2006-12-02 21:07 ` vector->list Marius Vollmer
1 sibling, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2006-12-01 20:09 UTC (permalink / raw)
Cc: bug-guile, Marius Vollmer
Szavai Gyula <szgyg@ludens.elte.hu> writes:
>
> (let ((b (make-shared-array #(1) (lambda (x) '(0)) 2)))
Thanks, though I'm not sure that's supposed to work. I suspect you're
not meant to make parts of the old array appear in more than one place
in the new array. Perhaps Marius can say what the intention is.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vector->list
2006-12-01 20:09 ` vector->list Kevin Ryde
@ 2006-12-02 21:07 ` Marius Vollmer
0 siblings, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2006-12-02 21:07 UTC (permalink / raw)
Cc: bug-guile
Kevin Ryde <user42@zip.com.au> writes:
> Szavai Gyula <szgyg@ludens.elte.hu> writes:
>>
>> (let ((b (make-shared-array #(1) (lambda (x) '(0)) 2)))
>
> Thanks, though I'm not sure that's supposed to work. I suspect you're
> not meant to make parts of the old array appear in more than one place
> in the new array. Perhaps Marius can say what the intention is.
Hmm, I've never thought about this case. However, if I understand
things right, it is well defined and we should support it.
My understanding is that we are talking about mapping functions here
that are constant. That's maybe a bit unusual, but covered by the
'theory' explained in the manual.
We have warnings in the manual that the increments for a dimension can
be negative and that people should be prepared for that. We should
extend those warnings to zero increments. (And probably review our
own code.)
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-12-02 21:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-28 12:51 vector->list Szavai Gyula
2006-11-29 9:25 ` vector->list Ludovic Courtès
2006-12-01 20:09 ` vector->list Kevin Ryde
2006-12-02 21:07 ` vector->list 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).