chicken-users
[Top][All Lists]

[Chicken-users] Problem w/ srfi-47.scm

 From: Kon Lovett Subject: [Chicken-users] Problem w/ srfi-47.scm Date: Fri, 30 Sep 2005 20:11:44 -0700

```Hi,

```
srfi-47 was written w/ the assumption that a instance of a variable 'x' in the body of a form '(define x ...)' references the "earlier" binding. So w/ CHICKEN 2.201 (array? (make-arrary '#() 2 2)) will loop forever. Below is a patch for srfi-47.scm to correct this and another problem.
```
Best Wishes,
Kon

---
54a55,56
> (define array:predicate? array?)
>
57,63c59,67
< (define array?
<   (lambda (obj)
<     (or (string? obj)
<       (vector? obj)
<       (and (##sys#generic-structure? obj)
```
< (memq (##sys#slot obj 0) '(u8vector u16vector s8vector s16vector u32vector s32vector f32vector f64vector)) )
```<       (array? obj))))
---
> (define (array? obj)
>       ; can't be immediate data, ##sys#generic-structure? will blow
>       (and (not (or (fixnum? obj) (char? obj) (boolean? obj)))
>               (or (string? obj)
>                       (vector? obj)
>                       (and (##sys#generic-structure? obj)
>                                (memq (##sys#slot obj 0)
```
> '(u8vector u16vector s8vector s16vector u32vector s32vector f32vector f64vector)))
```>                       (array:predicate? obj))))

```