[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: generalized-arrays egg, array-read fails on array written with array
From: |
Jeremy Steward |
Subject: |
Re: generalized-arrays egg, array-read fails on array written with array-write |
Date: |
Thu, 15 Dec 2022 17:31:58 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.5.1 |
Hey Matt, author here:
On 12/15/22 10:28, Matt Welland wrote:
This seems like a bug (unless I'm missing something?):
(module justtesting *
(import scheme chicken.base generalized-arrays storage-classes)
(define (testit)
(let* ((size (vector 100 100))
(ary (make-array vector-storage-class size 0)))
(with-output-to-file "testarray.dat"
(lambda ()
(array-write ary)))
(print "wrote array to testarray.dat")
(let* ((readdata (with-input-from-file "testarray.dat"
array-read)))
(print "read data into readdata: "readdata))))
(testit))
OUTPUT:
wrote array to testarray.dat
Error: Expected a char representing a digit.: #\#
Call history:
array-write-read.scm:1: ##sys#with-environment
array-write-read.scm:1: ##sys#register-compiled-module
array-write-read.scm:4: chicken.load#load-extension
array-write-read.scm:4: chicken.load#load-extension
array-write-read.scm:34: testit
array-write-read.scm:23: generalized-arrays#make-array
array-write-read.scm:24: scheme#with-output-to-file
array-write-read.scm:27: generalized-arrays#array-write
array-write-read.scm:28: chicken.base#print
array-write-read.scm:29: scheme#with-input-from-file <--
Is this with CHICKEN 4, or 5, or both? I can test on my own but I want
to be sure I get the environment right. I suspect it is a bug and you
are indeed not mistaken, and I should probably take this egg down until
I get time to do a proper v2.0 or whatever.
For context for the list: there are at least two bugs I know of (this
being one of them now) that exist within the library as it currently
exists. The other is an indexing bug in array-fold I believe, but I need
to go back and check. Once upon a time I undertook a redesign of the
underlying API to evaluate different ways to work with indices so as to:
1. Provide faster iteration AND
2. Improve clarity / correctness of the code
But ended up never finishing that work. I do still want to fix this and
make it useful, but I haven't been as active in the CHICKEN community in
the past couple years, mostly due to being too engrossed with work.
I appreciate the bug report though. Is there a ticket on
<https://bugs.call-cc.org>? I believe the official repo is now on GitLab
<https://gitlab.com/ThatGeoGuy/chicken-generalized-arrays>, but I can
throw an issue up and think about better ways to solve this.
Since writing this egg many years ago I've implemented various array /
math libraries and now think I have a better appreciation for how to do
it better. I really just need to make time for it, and I've not done a
great job here.
In the meanwhile, I'm happy to collect any other bug reports or test
cases. Either in the above repo or the CHICKEN bug tracker are fine, I
keep notifications on both and try to remain active on the list even if
I'm not being as good a maintainer in other ways.
Cheers,
--
Jeremy Steward