Re: generalized-arrays egg, array-read fails on array written with array-write

2022-12-17 Thread Matt Welland
Hi Jeremy,

Thanks for the response. This was with Chicken 5. I found
generalized-arrays easy to understand and I like the api. Most of the other
array eggs either had some limitation or were tough to understand how to
use. However I think I'll be able to make srfi-63 work for now. If you ever
get a chance to fix generalized-arrays I'd likely switch back.

Thanks again,
Matt
-=-

On Thu, Dec 15, 2022 at 12:28 PM 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   <--
>
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: generalized-arrays egg, array-read fails on array written with array-write

2022-12-15 Thread Jeremy Steward

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 
? I believe the official repo is now on GitLab 
, 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



generalized-arrays egg, array-read fails on array written with array-write

2022-12-15 Thread Matt Welland
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   <--

--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.