Changeset 9544 in project


Ignore:
Timestamp:
03/13/08 17:26:48 (12 years ago)
Author:
Kon Lovett
Message:

Rel 3.1.0 w/ SRFI 58 support.

Location:
release/3/array-lib
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/3/array-lib/tags/3.1.0/array-lib-eggdoc.scm

    r9531 r9544  
    6262(list->array 2 '#() '((1 2) (3 4)))     ; => #2A((1 2) (3 4))
    6363(list->array 0 '#() 3)
    64 ;Note vector returned, per SRFI-63      ; => #(3)
     64;Note vector returned, per SRFI 63      ; => #(3)
    6565
    6666(array->list (array '(2 3) 'ho 'ho 'ho 'ho 'oh 'oh))    ; => ((ho ho ho) (ho oh oh))
     
    139139  (eggdoc:begin
    140140    (name "array-lib")
    141     (description (p "Provides a SRFI-63 workalike"))
     141    (description (p "Provides a SRFI 63 workalike"))
    142142    (usage)
    143143    (requires
    144       (url "http://www.call-with-current-continuation.org/eggs/srfi-42.html" "SRFI-42")
     144      (url "http://www.call-with-current-continuation.org/eggs/srfi-42.html" "SRFI 42")
    145145      (url "http://www.call-with-current-continuation.org/eggs/misc-extn.html" "misc-extn")
    146146      (url "http://www.call-with-current-continuation.org/eggs/miscmacros.html" "miscmacros") )
     
    150150
    151151      (p "The array-lib purports to be a Chicken workalike for "
    152       (url "http://srfi.schemers.org/srfi-47/srfi-47.html" "SRFI-47") ", "
    153       (url "http://srfi.schemers.org/srfi-63/srfi-63.html" "SRFI-63") ", "
     152      (url "http://srfi.schemers.org/srfi-47/srfi-47.html" "SRFI 47") ", "
     153      (url "http://srfi.schemers.org/srfi-63/srfi-63.html" "SRFI 63") ", "
     154      (url "http://srfi.schemers.org/srfi-58/srfi-58.html" "SRFI 58") ", "
    154155      "and the SLIB array, subarray & arraymap modules.")
    155156
    156       (subsection "SRFI-63 Discussion"
    157 
    158         (p "The signatures of all SRFI-63 procedures are supported by "
     157      (subsection "Discussion"
     158
     159        (p "The signatures of all SRFI 63 procedures are supported by "
    159160        "this API, only with extended interpretations.")
    160161
    161         (p "However, unlike SRFI-63, the " (tt "equal?") " procedure is "
     162        (p "However, unlike SRFI 63, the " (tt "equal?") " procedure is "
    162163        (em "not") " automatically rebound! An extension, " (tt "array-lib-equal")
    163164        ", is available that provides a rebound procedure.")
    164165
    165         (p "Both SRFI-47 and SRFI-63 array prototype procedures are supplied, "
     166        (p "The SRFI 58 \"sharp A\" forms are supported.")
     167
     168        (p "Both SRFI 47 and SRFI 63 array prototype procedures are supplied, "
    166169        "including complex prototypes (see below).")
    167170
    168171        (p "Array constructors will return the underlying storage "
    169172        "object, rather than an array object, when the constructed array "
    170         "is 0-origin & rank = 1, per SRFI-63.")
     173        "is 0-origin & rank = 1, per SRFI 63.")
    171174
    172175        (p "The array-lib operations are in general thread-safe. See "
     
    196199
    197200        (p "All magnitudes of indices, dimensions, bounds, ranks, intervals "
    198         (b "are") " fixnums. Not much of a restiction from SRFI-63, just a "
     201        (b "are") " fixnums. Not much of a restiction from SRFI 63, just a "
    199202        "clarification.")
    200203
     
    203206
    204207        (p "An inner or outer dimension of " (code "0") " will result in an "
    205         "empty array. Per the SRFI-63 implementation.")
     208        "empty array. Per the SRFI 63 implementation.")
    206209      )
    207210
    208211      (subsection "Read Syntax"
    209212
    210         (p "A " (url "http://srfi.schemers.org/srfi-10/srfi-10.html" "SRFI-10") " "
     213        (p "A " (url "http://srfi.schemers.org/srfi-10/srfi-10.html" "SRFI 10") " "
    211214        "printer and reader is supplied.")
    212215
     
    216219        "of all the elements, in row-major order.")
    217220
    218         (p "The SRFI-10 print-form preserves the underlying storage "
     221        (p "The SRFI 10 print-form preserves the underlying storage "
    219222        "model and shape information, unlike the #nA form, which only "
    220223        "preserves the rank and element values. So, reading the #nA form "
     
    249252          "fixnum.") )
    250253
    251         (parameter "(current-array-print-form [FORM 'SRFI-10])"
     254        (parameter "(current-array-print-form [FORM 'SRFI 10])"
    252255          (p "Gets or sets the format for printing an array, either "
    253           (code "'SRFI-10") ", " (code "'A") ", or " (code "#f") " which "
     256          (code "'SRFI 10") ", " (code "'A") ", or " (code "#f") " which "
    254257          "turns off array element printing.") )
    255258
     
    344347          (p "Returns whether the object is an array object, or "
    345348          "accepted as an array. Builtin objects are vector, string, "
    346           "and " (url "http://srfi.schemers.org/srfi-4/srfi-4.html" "SRFI-4") " "
     349          "and " (url "http://srfi.schemers.org/srfi-4/srfi-4.html" "SRFI 4") " "
    347350          "vectors.") )
    348351
     
    559562      (subsection "Accessors"
    560563
    561         (p "SRFI-17 is supported.")
     564        (p "SRFI 17 is supported.")
    562565
    563566        (procedure "(array-ref ARRAY INDEX ...)"
     
    815818      (subsection "Prototypes"
    816819
    817         (p "SRFI-63")
     820        (p "SRFI 63")
    818821
    819822        (procedure "(A:floC128b [INITIAL])"
     
    896899          (p "Returns a boolean uniform-array prototype.") )
    897900
    898         (p "SRFI-47")
     901        (p "SRFI 47")
    899902
    900903        (procedure "(ac64 [INITIAL])"
     
    986989    (section "Issues"
    987990
    988       (p "SRFI-25 indexing is 2.4 times faster! However, 'array-lib' has "
    989       "faster indexing than the reference SRFI-63 implementation.")
    990 
    991       (p "Array aggregate operations are implemented in an element by "
    992       "element fashion.")
    993 
    994       (p "The SRFI-42 general dispatcher " (code "(: ...)") " does not "
    995       "recognize arrays.")
     991      (p "SRFI 25 indexing is 2.4 times faster! However, 'array-lib' has "
     992      "faster indexing than the reference SRFI 63 implementation.")
     993
     994      (p "Array aggregate operations are implemented in an element by element fashion.")
     995
     996      (p "The SRFI 42 general dispatcher " (code "(: ...)") " does not recognize arrays.")
    996997
    997998      (p "The 128-bit & 64-bit prototypes are currently implemented as unpacked vectors.")
    998999
    999       (p "Full SRFI-58 implementation except for the '#<dimensions>...' form.")
    1000 
    1001       (p "Doesn't print full SRFI-58 form.")
     1000      (p "The SRFI 58 form '#<dimensions>...' is unsupported.")
     1001
     1002      (p "Doesn't print full SRFI 58 form.")
    10021003    )
    10031004
     
    10111012
    10121013    (history
    1013       (version "3.1.0" "Bug fix for SRFI-63 prototype names & more SRFI-58 support.")
    1014       (version "3.001" "Bug fix for SRFI-63 prototype names.")
     1014      (version "3.1.0" "Bug fix for SRFI 63 prototype names & more SRFI 58 support.")
     1015      (version "3.001" "Bug fix for SRFI 63 prototype names.")
    10151016      (version "3.0" "Bug fix for dimensions of 0 - these should result in an empty array - and not be treated as a synonym of dimension 1. Added 'array-dimensions-object' & 'array-shape-object'.")
    1016       (version "2.117" "Added SRFI-17 support.")
     1017      (version "2.117" "Added SRFI 17 support.")
    10171018      (version "2.116" "Added 'array-prototype'.")
    10181019      (version "2.115" "'array' can now return an empty array with dimensions. Added 'array-length'.")
  • release/3/array-lib/tags/3.1.0/array-lib-sem.scm

    r9531 r9544  
    99;; a user will create any new storage definitions BEFORE threading.
    1010
    11 (use srfi-1 srfi-4 lolevel)
    12 (use misc-extn-list)
    13 
    1411(eval-when (compile)
    1512  (declare
     
    1714    (import
    1815      current-array-bounds-check
    19       current-array-element-check)
     16      current-array-element-check )
    2017    (bound-to-procedure
    21       arr$find-storedef)
     18      arr$find-storedef )
    2219    (export
    2320      ;; Internal API
     
    2926      arr$*builtin-storedef-list*     ; immutable
    3027      ;
     28      arr$error/type/element
    3129      arr$error/type/array
    32       #;arr$error/type/procedure
    33       #;arr$error/type/symbol
     30      arr$error/type/procedure
     31      arr$error/type/symbol
    3432      arr$error/type/dimensionality
    3533      arr$error/bounds
     
    105103      A:fixN8b
    106104      A:bool
    107       ac64
    108       ac32
    109       ar64
    110       ar32
    111       as64
    112       as32
    113       as16
    114       as8
    115       au64
    116       au32
    117       au16
    118       au8
    119       at1
    120       ;DEPRECATED
    121105      a:floc128b
    122106      a:floc64b
     
    138122      a:fixn16b
    139123      a:fixn8b
    140       a:bool) ) )
     124      a:bool
     125      ac64
     126      ac32
     127      ar64
     128      ar32
     129      as64
     130      as32
     131      as16
     132      as8
     133      au64
     134      au32
     135      au16
     136      au8
     137      at1 ) ) )
     138
     139(use srfi-1 srfi-4 lolevel)
     140(use misc-extn-list)
    141141
    142142;;;
     
    149149;; Always false.
    150150
    151 (define false (constantly #f))
     151(define false (lambda _ #f))
    152152
    153153;;
     
    204204;;; Error Procedures
    205205;;;
     206
     207(define (arr$error/type/element loc . args)
     208  (abort (make-exn-array-type-condition loc "invalid element" args)) )
    206209
    207210(define (arr$error/type/array loc . args)
     
    615618                   (let ([bnd (car shp)])
    616619                     (and (arr$index-in-bound? idx bnd)
    617                           (loop (cdr shp) (cdr idxs)) ) ) ) )]) ) )
     620                          (loop (cdr shp) (cdr idxs)) ) ) ) ) ] ) ) )
    618621
    619622;;;
     
    631634(define (arr$ec-no-empty-arrays . arrs)
    632635  (filter
    633     (lambda (arr)
    634       (let ([len (arr$length arr)])
    635         (unless len
    636           (arr$error/type/array 'ec arr))
    637         (< 0 len)))
    638     arrs) )
     636   (lambda (arr)
     637     (let ([len (arr$length arr)])
     638       (unless len
     639         (arr$error/type/array 'ec arr))
     640       (< 0 len) ) )
     641   arrs) )
    639642
    640643;;;
     
    666669        [else                     ; Try special case
    667670          (or (func dim)
    668               (arr$error/type/dimensionality loc dim))]) )
     671              (arr$error/type/dimensionality loc dim)) ] ) )
    669672
    670673;; Returns a plain list shape form given an argument form
     
    684687          '()]
    685688        [else
    686           (arr$error/type/dimensionality loc dims)]) )
     689          (arr$error/type/dimensionality loc dims) ] ) )
    687690
    688691;; Process 'rest arguments' shape/etc. form
     
    715718              (loop (cons rnk dims)
    716719                    (- rnk 1)
    717                     (* rnk fact))]) ) ) )
     720                    (* rnk fact)) ] ) ) ) )
    718721
    719722;;;
     
    974977                          siz
    975978                          (loop (cdr nlens) (cdr nscls)
    976                                 (* siz (car nlens))
    977979                                #; ;NO ZERO DIMENSIONS
    978980                                (let ([len (car nlens)])
    979981                                  (if (or (= 0 len) (= 0 (car nscls)))  ; 0 length dimension?
    980982                                      siz
    981                                       (* siz len) ) ) ) ) )])
     983                                      (* siz len) ) )
     984                                (* siz (car nlens)) ) ) )])
    982985              ; Make mapped array
    983986              (arr$make-array nshp nscls noff
     
    995998(define (make-prototype-checker name pred? creator)
    996999  (lambda args
    997     (switch (length args)
    998       [0 (creator)]
    999       [1 (let ([init (car args)])
    1000             (if (pred? init)
    1001                 (creator init)
    1002                 (arr$error 'make-prototype-checker "incompatible element type" name init)))]
     1000    (case (length args)
     1001      [(0)
     1002       (creator)]
     1003      [(1)
     1004       (let ([init (car args)])
     1005         (if (pred? init)
     1006             (creator init)
     1007             (arr$error/type/element 'make-prototype-checker name init) ) ) ]
    10031008      [else
    1004         (arr$error 'make-prototype-checker "too many arguments" name args)])))
     1009        (arr$error 'make-prototype-checker "too many arguments" name args) ] ) ) )
     1010
     1011;; Complex
    10051012
    10061013;;@args z
    10071014;;@args
    10081015;;Returns an inexact 128 bit floatingpoint complex uniform-array prototype.
     1016
    10091017(define A:floC128b (make-prototype-checker 'A:floC128b complex? vector))
     1018
    10101019;;@args z
    10111020;;@args
    10121021;;Returns an inexact 64 bit floatingpoint complex uniform-array prototype.
     1022
    10131023(define A:floC64b (make-prototype-checker 'A:floC64b complex? vector))
     1024
    10141025;;@args z
    10151026;;@args
    10161027;;Returns an inexact 32 bit floatingpoint complex uniform-array prototype.
     1028
    10171029(define A:floC32b (make-prototype-checker 'A:floC32b complex? vector))
     1030
    10181031;;@args z
    10191032;;@args
    10201033;;Returns an inexact 16 bit floatingpoint complex uniform-array prototype.
     1034
    10211035(define A:floC16b (make-prototype-checker 'A:floC16b complex? vector))
    10221036
     1037;; Real
     1038
    10231039;;@args z
    10241040;;@args
    10251041;;Returns an inexact 128 bit floatingpoint real uniform-array prototype.
     1042
    10261043(define A:floR128b (make-prototype-checker 'A:floR128b real? vector))
     1044
    10271045;;@args z
    10281046;;@args
    10291047;;Returns an inexact 64 bit floatingpoint real uniform-array prototype.
     1048
    10301049(define A:floR64b (make-prototype-checker 'A:floR64b real? f64vector))
     1050
    10311051;;@args z
    10321052;;@args
    10331053;;Returns an inexact 32 bit floatingpoint real uniform-array prototype.
     1054
    10341055(define A:floR32b (make-prototype-checker 'A:floR32b real? f32vector))
     1056
    10351057;;@args z
    10361058;;@args
    10371059;;Returns an inexact 16 bit floatingpoint real uniform-array prototype.
     1060
    10381061(define A:floR16b (make-prototype-checker 'A:floR16b real? f32vector))
    10391062
     1063;; Rational
     1064
    10401065;;@args z
    10411066;;@args
    10421067;;Returns an exact 128 bit decimal rational uniform-array prototype.
     1068
    10431069(define A:floQ128d (make-prototype-checker 'A:floQ128d exact-rational? vector))
     1070
    10441071;;@args z
    10451072;;@args
    10461073;;Returns an exact 64 bit decimal rational uniform-array prototype.
     1074
    10471075(define A:floQ64d (make-prototype-checker 'A:floQ64d exact-rational? vector))
     1076
    10481077;;@args z
    10491078;;@args
    10501079;;Returns an exact 32 bit decimal rational uniform-array prototype.
     1080
    10511081(define A:floQ32d (make-prototype-checker 'A:floQ32d exact-rational? vector))
     1082
     1083;; Exact
    10521084
    10531085;;@args n
     
    10551087;;Returns an exact binary exact integer uniform-array prototype with at least
    10561088;;64 bits of precision.
     1089
    10571090(define A:fixZ64b (make-prototype-checker 'A:fixZ64b signed-integer-64? vector))
     1091
    10581092;;@args n
    10591093;;@args
    10601094;;Returns an exact binary exact integer uniform-array prototype with at least
    10611095;;32 bits of precision.
     1096
    10621097(define A:fixZ32b (make-prototype-checker 'A:fixZ32b signed-integer-32? s32vector))
     1098
    10631099;;@args n
    10641100;;@args
    10651101;;Returns an exact binary exact integer uniform-array prototype with at least
    10661102;;16 bits of precision.
     1103
    10671104(define A:fixZ16b (make-prototype-checker 'A:fixZ16b signed-integer-16? s16vector))
     1105
    10681106;;@args n
    10691107;;@args
    10701108;;Returns an exact binary exact integer uniform-array prototype with at least
    10711109;;8 bits of precision.
     1110
    10721111(define A:fixZ8b (make-prototype-checker 'A:fixZ8b signed-integer-8? s8vector))
     1112
     1113;; Exact Natural
    10731114
    10741115;;@args k
     
    10761117;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10771118;;least 64 bits of precision.
     1119
    10781120(define A:fixN64b (make-prototype-checker 'A:fixN64b unsigned-integer-64? vector))
     1121
    10791122;;@args k
    10801123;;@args
    10811124;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10821125;;least 32 bits of precision.
     1126
    10831127(define A:fixN32b (make-prototype-checker 'A:fixN32b unsigned-integer-32? u32vector))
     1128
    10841129;;@args k
    10851130;;@args
    10861131;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10871132;;least 16 bits of precision.
     1133
    10881134(define A:fixN16b (make-prototype-checker 'A:fixN16b unsigned-integer-16? u16vector))
     1135
    10891136;;@args k
    10901137;;@args
    10911138;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10921139;;least 8 bits of precision.
     1140
    10931141(define A:fixN8b (make-prototype-checker 'A:fixN8b unsigned-integer-8? u8vector))
    10941142
     1143;; Boolean
     1144
    10951145;;@args bool
    10961146;;@args
    10971147;;Returns a boolean uniform-array prototype.
     1148
    10981149(define A:bool (make-prototype-checker 'A:bool boolean? vector))
    10991150
    1100 ;; SRFI-47 names
    1101 
    1102 (define ac64 a:floc64b)
    1103 (define ac32 a:floc32b)
    1104 (define ar64 a:flor64b)
    1105 (define ar32 a:flor32b)
    1106 (define as64 a:fixz64b)
    1107 (define as32 a:fixz32b)
    1108 (define as16 a:fixz16b)
    1109 (define as8 a:fixz8b)
    1110 (define au64 a:fixn64b)
    1111 (define au32 a:fixn32b)
    1112 (define au16 a:fixn16b)
    1113 (define au8 a:fixn8b)
    1114 (define at1 a:bool)
    1115 
    1116 ;; array-lib names ;DEPRECATED
    1117 
    1118 (define a:floc128b A:floC128b)
    1119 (define a:floc64b A:floC64b)
    1120 (define a:floc32b A:floC32b)
    1121 (define a:floc16b A:floC16b)
    1122 (define a:flor128b A:floR128b)
    1123 (define a:flor64b A:floR64b)
    1124 (define a:flor32b A:floR32b)
    1125 (define a:flor16b A:floR16b)
    1126 (define a:floq128b A:floQ128d)
    1127 (define a:floq64b A:floQ64d)
    1128 (define a:floq32b A:floQ32d)
    1129 (define a:fixz64b A:fixZ64b)
    1130 (define a:fixz32b A:fixZ32b)
    1131 (define a:fixz16b A:fixZ16b)
    1132 (define a:fixz8b A:fixZ8b)
    1133 (define a:fixn64b A:fixN64b)
    1134 (define a:fixn32b A:fixN32b)
    1135 (define a:fixn16b A:fixN16b)
    1136 (define a:fixn8b A:fixN8b)
    1137 (define a:bool A:bool)
     1151;; Lowercase names
     1152
     1153(define a:floc128b  A:floC128b)
     1154(define a:floc64b   A:floC64b)
     1155(define a:floc32b   A:floC32b)
     1156(define a:floc16b   A:floC16b)
     1157(define a:flor128b  A:floR128b)
     1158(define a:flor64b   A:floR64b)
     1159(define a:flor32b   A:floR32b)
     1160(define a:flor16b   A:floR16b)
     1161(define a:floq128b  A:floQ128d)
     1162(define a:floq64b   A:floQ64d)
     1163(define a:floq32b   A:floQ32d)
     1164(define a:fixz64b   A:fixZ64b)
     1165(define a:fixz32b   A:fixZ32b)
     1166(define a:fixz16b   A:fixZ16b)
     1167(define a:fixz8b    A:fixZ8b)
     1168(define a:fixn64b   A:fixN64b)
     1169(define a:fixn32b   A:fixN32b)
     1170(define a:fixn16b   A:fixN16b)
     1171(define a:fixn8b    A:fixN8b)
     1172(define a:bool      A:bool)
     1173
     1174;; SRFI 47 names
     1175
     1176(define ac64  a:floc64b)
     1177(define ac32  a:floc32b)
     1178(define ar64  a:flor64b)
     1179(define ar32  a:flor32b)
     1180(define as64  a:fixz64b)
     1181(define as32  a:fixz32b)
     1182(define as16  a:fixz16b)
     1183(define as8   a:fixz8b)
     1184(define au64  a:fixn64b)
     1185(define au32  a:fixn32b)
     1186(define au16  a:fixn16b)
     1187(define au8   a:fixn8b)
     1188(define at1   a:bool)
  • release/3/array-lib/tags/3.1.0/array-lib-syn.scm

    r9531 r9544  
    3838
    3939(define-inline (->boolean obj)
    40   (and obj #t) )
     40  (and obj
     41       #t) )
    4142
    4243;; Array storage definition record
     
    9293#; ;UNUSED
    9394(define-inline (arr$range-empty? l h)
    94   #;
    95   (= l h)
    96   (or (= l h)
    97       (< h l) ) )
     95  (= l h) )
    9896
    9997;; Bounds object (closed interval)
     
    112110#; ;UNUSED
    113111(define-inline (arr$bounds-empty? bnds)
    114   (arr$range-empty? (arr$bounds-low bnds) (arr$bounds-high bnds)) )
     112  (let ([h (arr$bounds-high bnds)])
     113    (or (= -1 h)
     114        (arr$range-empty? (arr$bounds-low bnds) h) ) ) )
    115115
    116116;; Calculate number of elements in a closed interval (bounds object)
     
    121121;; Closed interval (bounds object) -> open interval (a list)
    122122
     123#; ;NO ZERO DIMENSIONS
     124(define-inline (arr$bounds->interval bnds)
     125  (let ([l (arr$bounds-low bnds)]
     126        [h (arr$bounds-high bnds)])
     127    (list l (if (arr$range-empty? l h) h (+ h 1))) ) )
     128
    123129(define-inline (arr$bounds->interval bnds)
    124130  (list (arr$bounds-low bnds) (+ (arr$bounds-high bnds) 1)) )
     
    126132;; Open interval -> closed interval (bounds object)
    127133
     134#; ;NO ZERO DIMENSIONS
     135(define-inline (arr$interval->bounds l h)
     136  (arr$make-bounds l (if (arr$range-empty? l h) h (- h 1))) )
     137
    128138(define-inline (arr$interval->bounds l h)
    129139  (arr$make-bounds l (- h 1)) )
     
    132142
    133143(define-inline (arr$index-in-bound? idx bnds)
     144  (<= (arr$bounds-low bnds) idx (arr$bounds-high bnds))
     145  #;
    134146  (and (<= (arr$bounds-low bnds) idx)
    135147       (let ([h (arr$bounds-high bnds)])
     
    154166;; when necessary. i.e. this will state the length
    155167;; of an empty array is 1!
     168
     169#; ;NO ZERO DIMENSIONS
     170(define-inline (arr$lengths->length lens)
     171  ; Inlined version of
     172  ; (reduce (lambda (tot len) (if (= 0 len) tot (* tot len))) 1 lens)
     173  (let loop ([lens lens]
     174             [tot 1])
     175    (if (null? lens)
     176        tot
     177        (loop (cdr lens)
     178              (let ([len (car lens)])
     179                (if (= 0 len)
     180                    tot
     181                    (* tot len)))) ) ) )
    156182
    157183(define-inline (arr$lengths->length lens)
     
    166192  (let loop ([shp shp] [lens '()])
    167193    (if (null? shp)
    168       (reverse! lens)
    169       (loop (cdr shp) (cons (arr$bounds-length (car shp)) lens)) ) ) )
     194        (reverse! lens)
     195        (loop (cdr shp) (cons (arr$bounds-length (car shp)) lens)) ) ) )
    170196
    171197;; Calculate the number of linear elements for a shape
     
    187213(define-inline (arr$ref storedef arr idxs)
    188214  (if (arr$array? arr)
    189     ((arr$storedef-ref storedef) (arr$array-store arr) (arr$array-store-index arr idxs))
    190     ((arr$storedef-ref storedef) arr (car idxs))))
     215      ((arr$storedef-ref storedef) (arr$array-store arr) (arr$array-store-index arr idxs))
     216      ((arr$storedef-ref storedef) arr (car idxs))))
    191217
    192218;; Backend array element set!
     
    194220(define-inline (arr$set! storedef arr obj idxs)
    195221  (if (arr$array? arr)
    196     ((arr$storedef-set storedef) (arr$array-store arr) (arr$array-store-index arr idxs) obj)
    197     ((arr$storedef-set storedef) arr (car idxs) obj)))
     222      ((arr$storedef-set storedef) (arr$array-store arr) (arr$array-store-index arr idxs) obj)
     223      ((arr$storedef-set storedef) arr (car idxs) obj)))
    198224
    199225;; Perform type check query.
  • release/3/array-lib/tags/3.1.0/array-lib.html

    r9531 r9544  
    152152<div class="section">
    153153<h3>Description</h3>
    154 <p>Provides a SRFI-63 workalike</p></div>
     154<p>Provides a SRFI 63 workalike</p></div>
    155155<div class="section">
    156156<h3>Usage</h3><tt>(require-extension array-lib)</tt></div>
     
    158158<h3>Requires</h3>
    159159<ul>
    160 <li><a href="http://www.call-with-current-continuation.org/eggs/srfi-42.html">SRFI-42</a></li>
     160<li><a href="http://www.call-with-current-continuation.org/eggs/srfi-42.html">SRFI 42</a></li>
    161161<li><a href="http://www.call-with-current-continuation.org/eggs/misc-extn.html">misc-extn</a></li>
    162162<li><a href="http://www.call-with-current-continuation.org/eggs/miscmacros.html">miscmacros</a></li></ul></div>
     
    165165<div class="section">
    166166<h3>Documentation</h3>
    167 <p>The array-lib purports to be a Chicken workalike for <a href="http://srfi.schemers.org/srfi-47/srfi-47.html">SRFI-47</a>, <a href="http://srfi.schemers.org/srfi-63/srfi-63.html">SRFI-63</a>, and the SLIB array, subarray &amp; arraymap modules.</p>
    168 <div class="subsection">
    169 <h4>SRFI-63 Discussion</h4>
    170 <p>The signatures of all SRFI-63 procedures are supported by this API, only with extended interpretations.</p>
    171 <p>However, unlike SRFI-63, the <tt>equal?</tt> procedure is <em>not</em> automatically rebound! An extension, <tt>array-lib-equal</tt>, is available that provides a rebound procedure.</p>
    172 <p>Both SRFI-47 and SRFI-63 array prototype procedures are supplied, including complex prototypes (see below).</p>
    173 <p>Array constructors will return the underlying storage object, rather than an array object, when the constructed array is 0-origin &amp; rank = 1, per SRFI-63.</p>
     167<p>The array-lib purports to be a Chicken workalike for <a href="http://srfi.schemers.org/srfi-47/srfi-47.html">SRFI 47</a>, <a href="http://srfi.schemers.org/srfi-63/srfi-63.html">SRFI 63</a>, <a href="http://srfi.schemers.org/srfi-58/srfi-58.html">SRFI 58</a>, and the SLIB array, subarray &amp; arraymap modules.</p>
     168<div class="subsection">
     169<h4>Discussion</h4>
     170<p>The signatures of all SRFI 63 procedures are supported by this API, only with extended interpretations.</p>
     171<p>However, unlike SRFI 63, the <tt>equal?</tt> procedure is <em>not</em> automatically rebound! An extension, <tt>array-lib-equal</tt>, is available that provides a rebound procedure.</p>
     172<p>The SRFI 58 &quot;sharp A&quot; forms are supported.</p>
     173<p>Both SRFI 47 and SRFI 63 array prototype procedures are supplied, including complex prototypes (see below).</p>
     174<p>Array constructors will return the underlying storage object, rather than an array object, when the constructed array is 0-origin &amp; rank = 1, per SRFI 63.</p>
    174175<p>The array-lib operations are in general thread-safe. See <code>array:thread-safe</code> and <code>array:storage-definition</code> below for exceptions.</p></div>
    175176<div class="subsection">
     
    178179<p>A <em>Shape</em> is an ordered sequence of <em>Interval</em>, [lower upper), for each dimension. A shape maybe a list of interval list or a <code>shape</code> object. For example, <code>(0 1) (0 2)</code> is a shape of a rank 2 array, with the <em>bounds</em> of dimension one [0 0] and dimension two [0 1].</p>
    179180<p>The accepted list form of dimensions or shape for procedures taking these as tail arguments is as an 'exploded' list. Each element as an individual argument. For example, <code>(make-array '(1 2) '(-8 -5))</code>, not <code>(make-array '((1 2) (-8 -5)))</code>.</p>
    180 <p>All magnitudes of indices, dimensions, bounds, ranks, intervals <b>are</b> fixnums. Not much of a restiction from SRFI-63, just a clarification.</p>
     181<p>All magnitudes of indices, dimensions, bounds, ranks, intervals <b>are</b> fixnums. Not much of a restiction from SRFI 63, just a clarification.</p>
    181182<p>The dimensions <code>'(2 1 3)</code> are equivalent to the shape <code>'(0 2 0 1 0 3)</code>.</p>
    182 <p>An inner or outer dimension of <code>0</code> will result in an empty array. Per the SRFI-63 implementation.</p></div>
     183<p>An inner or outer dimension of <code>0</code> will result in an empty array. Per the SRFI 63 implementation.</p></div>
    183184<div class="subsection">
    184185<h4>Read Syntax</h4>
    185 <p>A <a href="http://srfi.schemers.org/srfi-10/srfi-10.html">SRFI-10</a> printer and reader is supplied.</p>
     186<p>A <a href="http://srfi.schemers.org/srfi-10/srfi-10.html">SRFI 10</a> printer and reader is supplied.</p>
    186187<p>An array specific read/print syntax is supplied: <code>#&lt;rank&gt;A&lt;elements&gt;</code>, where &lt;rank&gt; is the array dimensionality and &lt;elements&gt; are a rank-nested list consisting of all the elements, in row-major order.</p>
    187 <p>The SRFI-10 print-form preserves the underlying storage model and shape information, unlike the #nA form, which only preserves the rank and element values. So, reading the #nA form may not reconstruct the original array.</p>
     188<p>The SRFI 10 print-form preserves the underlying storage model and shape information, unlike the #nA form, which only preserves the rank and element values. So, reading the #nA form may not reconstruct the original array.</p>
    188189<p>Use <code>(current-array-print-form ...)</code> to select the desired form.</p>
    189190<p>A limit is placed on the number of array elements printed, which may be overridden. See <code>(current-array-print-count ...)</code>.</p></div>
     
    201202<dd>
    202203<p>Gets or sets the number of array elements to print. A <tt>COUNT</tt> of <code>#f</code> will set the count 0, and <code>#t</code> will set the count to a very big number. When <tt>COUNT</tt> is a number it must a zero or positive fixnum.</p></dd>
    203 <dt class="definition"><strong>parameter:</strong> (current-array-print-form [FORM 'SRFI-10])</dt>
    204 <dd>
    205 <p>Gets or sets the format for printing an array, either <code>'SRFI-10</code>, <code>'A</code>, or <code>#f</code> which turns off array element printing.</p></dd>
     204<dt class="definition"><strong>parameter:</strong> (current-array-print-form [FORM 'SRFI 10])</dt>
     205<dd>
     206<p>Gets or sets the format for printing an array, either <code>'SRFI 10</code>, <code>'A</code>, or <code>#f</code> which turns off array element printing.</p></dd>
    206207<dt class="definition"><strong>procedure:</strong> (array:thread-safe [FLAG])</dt>
    207208<dd>
     
    269270<dt class="definition"><strong>procedure:</strong> (array? ARRAY)</dt>
    270271<dd>
    271 <p>Returns whether the object is an array object, or accepted as an array. Builtin objects are vector, string, and <a href="http://srfi.schemers.org/srfi-4/srfi-4.html">SRFI-4</a> vectors.</p></dd>
     272<p>Returns whether the object is an array object, or accepted as an array. Builtin objects are vector, string, and <a href="http://srfi.schemers.org/srfi-4/srfi-4.html">SRFI 4</a> vectors.</p></dd>
    272273<dt class="definition"><strong>procedure:</strong> (array-strict? ARRAY)</dt>
    273274<dd>
     
    396397<div class="subsection">
    397398<h4>Accessors</h4>
    398 <p>SRFI-17 is supported.</p>
     399<p>SRFI 17 is supported.</p>
    399400<dt class="definition"><strong>procedure:</strong> (array-ref ARRAY INDEX ...)</dt>
    400401<dd>
     
    526527<div class="subsection">
    527528<h4>Prototypes</h4>
    528 <p>SRFI-63</p>
     529<p>SRFI 63</p>
    529530<dt class="definition"><strong>procedure:</strong> (A:floC128b [INITIAL])</dt>
    530531<dd>
     
    587588<dd>
    588589<p>Returns a boolean uniform-array prototype.</p></dd>
    589 <p>SRFI-47</p>
     590<p>SRFI 47</p>
    590591<dt class="definition"><strong>procedure:</strong> (ac64 [INITIAL])</dt>
    591592<dd>
     
    667668<div class="section">
    668669<h3>Issues</h3>
    669 <p>SRFI-25 indexing is 2.4 times faster! However, 'array-lib' has faster indexing than the reference SRFI-63 implementation.</p>
     670<p>SRFI 25 indexing is 2.4 times faster! However, 'array-lib' has faster indexing than the reference SRFI 63 implementation.</p>
    670671<p>Array aggregate operations are implemented in an element by element fashion.</p>
    671 <p>The SRFI-42 general dispatcher <code>(: ...)</code> does not recognize arrays.</p>
     672<p>The SRFI 42 general dispatcher <code>(: ...)</code> does not recognize arrays.</p>
    672673<p>The 128-bit &amp; 64-bit prototypes are currently implemented as unpacked vectors.</p>
    673 <p>Full SRFI-58 implementation except for the '#&lt;dimensions&gt;...' form.</p>
    674 <p>Doesn't print full SRFI-58 form.</p></div>
     674<p>Full SRFI 58 implementation except for the '#&lt;dimensions&gt;...' form.</p>
     675<p>Doesn't print full SRFI 58 form.</p></div>
    675676<div class="section">
    676677<h3>Examples</h3>
     
    692693(list-&gt;array 2 '#() '((1 2) (3 4)))  ; =&gt; #2A((1 2) (3 4))
    693694(list-&gt;array 0 '#() 3)
    694 ;Note vector returned, per SRFI-63      ; =&gt; #(3)
     695;Note vector returned, per SRFI 63      ; =&gt; #(3)
    695696
    696697(array-&gt;list (array '(2 3) 'ho 'ho 'ho 'ho 'oh 'oh)) ; =&gt; ((ho ho ho) (ho oh oh))
     
    771772<h3>Version</h3>
    772773<ul>
    773 <li>3.1.0 Bug fix for SRFI-63 prototype names &amp; more SRFI-58 support.</li>
    774 <li>3.001 Bug fix for SRFI-63 prototype names.</li>
     774<li>3.1.0 Bug fix for SRFI 63 prototype names &amp; more SRFI 58 support.</li>
     775<li>3.001 Bug fix for SRFI 63 prototype names.</li>
    775776<li>3.0 Bug fix for dimensions of 0 - these should result in an empty array - and not be treated as a synonym of dimension 1. Added 'array-dimensions-object' &amp; 'array-shape-object'.</li>
    776 <li>2.117 Added SRFI-17 support.</li>
     777<li>2.117 Added SRFI 17 support.</li>
    777778<li>2.116 Added 'array-prototype'.</li>
    778779<li>2.115 'array' can now return an empty array with dimensions. Added 'array-length'.</li>
  • release/3/array-lib/tags/3.1.0/array-lib.scm

    r9531 r9544  
    11211121              (display #\) out) ]
    11221122            ['A
     1123              ;FIXME need full SRFI 58 output form
    11231124              (let ([rnk (length shp)])
    11241125                (display "#" out) (write rnk out) (display #\A out)
    1125                 (when (= 0 rnk)
    1126                   (display #\space out))
     1126                (when (= 0 rnk) (display #\space out))
    11271127                (array-print arr (current-array-print-count) out shp) ) ] ) )
    11281128        ; else not printing array info
  • release/3/array-lib/tags/3.1.0/tests/array-lib-test.scm

    r9531 r9544  
    194194  )
    195195
    196   (test/case "O Dimension" (
    197       [arr1 (make-array '#(#f) 2 1 3)]
     196  (test/case "O Dimension" (warn "0 Dimensions unsupported - Test WILL Fail") (
     197      [arr1 (make-array '#(#f) 2 0 3)]
    198198      [arr2 (make-array '#(#f) 0 2 3)]
    199199      [arr3 (make-array '#(#f) 2 3 0)] )
  • release/3/array-lib/trunk/array-lib-eggdoc.scm

    r9531 r9544  
    6262(list->array 2 '#() '((1 2) (3 4)))     ; => #2A((1 2) (3 4))
    6363(list->array 0 '#() 3)
    64 ;Note vector returned, per SRFI-63      ; => #(3)
     64;Note vector returned, per SRFI 63      ; => #(3)
    6565
    6666(array->list (array '(2 3) 'ho 'ho 'ho 'ho 'oh 'oh))    ; => ((ho ho ho) (ho oh oh))
     
    139139  (eggdoc:begin
    140140    (name "array-lib")
    141     (description (p "Provides a SRFI-63 workalike"))
     141    (description (p "Provides a SRFI 63 workalike"))
    142142    (usage)
    143143    (requires
    144       (url "http://www.call-with-current-continuation.org/eggs/srfi-42.html" "SRFI-42")
     144      (url "http://www.call-with-current-continuation.org/eggs/srfi-42.html" "SRFI 42")
    145145      (url "http://www.call-with-current-continuation.org/eggs/misc-extn.html" "misc-extn")
    146146      (url "http://www.call-with-current-continuation.org/eggs/miscmacros.html" "miscmacros") )
     
    150150
    151151      (p "The array-lib purports to be a Chicken workalike for "
    152       (url "http://srfi.schemers.org/srfi-47/srfi-47.html" "SRFI-47") ", "
    153       (url "http://srfi.schemers.org/srfi-63/srfi-63.html" "SRFI-63") ", "
     152      (url "http://srfi.schemers.org/srfi-47/srfi-47.html" "SRFI 47") ", "
     153      (url "http://srfi.schemers.org/srfi-63/srfi-63.html" "SRFI 63") ", "
     154      (url "http://srfi.schemers.org/srfi-58/srfi-58.html" "SRFI 58") ", "
    154155      "and the SLIB array, subarray & arraymap modules.")
    155156
    156       (subsection "SRFI-63 Discussion"
    157 
    158         (p "The signatures of all SRFI-63 procedures are supported by "
     157      (subsection "Discussion"
     158
     159        (p "The signatures of all SRFI 63 procedures are supported by "
    159160        "this API, only with extended interpretations.")
    160161
    161         (p "However, unlike SRFI-63, the " (tt "equal?") " procedure is "
     162        (p "However, unlike SRFI 63, the " (tt "equal?") " procedure is "
    162163        (em "not") " automatically rebound! An extension, " (tt "array-lib-equal")
    163164        ", is available that provides a rebound procedure.")
    164165
    165         (p "Both SRFI-47 and SRFI-63 array prototype procedures are supplied, "
     166        (p "The SRFI 58 \"sharp A\" forms are supported.")
     167
     168        (p "Both SRFI 47 and SRFI 63 array prototype procedures are supplied, "
    166169        "including complex prototypes (see below).")
    167170
    168171        (p "Array constructors will return the underlying storage "
    169172        "object, rather than an array object, when the constructed array "
    170         "is 0-origin & rank = 1, per SRFI-63.")
     173        "is 0-origin & rank = 1, per SRFI 63.")
    171174
    172175        (p "The array-lib operations are in general thread-safe. See "
     
    196199
    197200        (p "All magnitudes of indices, dimensions, bounds, ranks, intervals "
    198         (b "are") " fixnums. Not much of a restiction from SRFI-63, just a "
     201        (b "are") " fixnums. Not much of a restiction from SRFI 63, just a "
    199202        "clarification.")
    200203
     
    203206
    204207        (p "An inner or outer dimension of " (code "0") " will result in an "
    205         "empty array. Per the SRFI-63 implementation.")
     208        "empty array. Per the SRFI 63 implementation.")
    206209      )
    207210
    208211      (subsection "Read Syntax"
    209212
    210         (p "A " (url "http://srfi.schemers.org/srfi-10/srfi-10.html" "SRFI-10") " "
     213        (p "A " (url "http://srfi.schemers.org/srfi-10/srfi-10.html" "SRFI 10") " "
    211214        "printer and reader is supplied.")
    212215
     
    216219        "of all the elements, in row-major order.")
    217220
    218         (p "The SRFI-10 print-form preserves the underlying storage "
     221        (p "The SRFI 10 print-form preserves the underlying storage "
    219222        "model and shape information, unlike the #nA form, which only "
    220223        "preserves the rank and element values. So, reading the #nA form "
     
    249252          "fixnum.") )
    250253
    251         (parameter "(current-array-print-form [FORM 'SRFI-10])"
     254        (parameter "(current-array-print-form [FORM 'SRFI 10])"
    252255          (p "Gets or sets the format for printing an array, either "
    253           (code "'SRFI-10") ", " (code "'A") ", or " (code "#f") " which "
     256          (code "'SRFI 10") ", " (code "'A") ", or " (code "#f") " which "
    254257          "turns off array element printing.") )
    255258
     
    344347          (p "Returns whether the object is an array object, or "
    345348          "accepted as an array. Builtin objects are vector, string, "
    346           "and " (url "http://srfi.schemers.org/srfi-4/srfi-4.html" "SRFI-4") " "
     349          "and " (url "http://srfi.schemers.org/srfi-4/srfi-4.html" "SRFI 4") " "
    347350          "vectors.") )
    348351
     
    559562      (subsection "Accessors"
    560563
    561         (p "SRFI-17 is supported.")
     564        (p "SRFI 17 is supported.")
    562565
    563566        (procedure "(array-ref ARRAY INDEX ...)"
     
    815818      (subsection "Prototypes"
    816819
    817         (p "SRFI-63")
     820        (p "SRFI 63")
    818821
    819822        (procedure "(A:floC128b [INITIAL])"
     
    896899          (p "Returns a boolean uniform-array prototype.") )
    897900
    898         (p "SRFI-47")
     901        (p "SRFI 47")
    899902
    900903        (procedure "(ac64 [INITIAL])"
     
    986989    (section "Issues"
    987990
    988       (p "SRFI-25 indexing is 2.4 times faster! However, 'array-lib' has "
    989       "faster indexing than the reference SRFI-63 implementation.")
    990 
    991       (p "Array aggregate operations are implemented in an element by "
    992       "element fashion.")
    993 
    994       (p "The SRFI-42 general dispatcher " (code "(: ...)") " does not "
    995       "recognize arrays.")
     991      (p "SRFI 25 indexing is 2.4 times faster! However, 'array-lib' has "
     992      "faster indexing than the reference SRFI 63 implementation.")
     993
     994      (p "Array aggregate operations are implemented in an element by element fashion.")
     995
     996      (p "The SRFI 42 general dispatcher " (code "(: ...)") " does not recognize arrays.")
    996997
    997998      (p "The 128-bit & 64-bit prototypes are currently implemented as unpacked vectors.")
    998999
    999       (p "Full SRFI-58 implementation except for the '#<dimensions>...' form.")
    1000 
    1001       (p "Doesn't print full SRFI-58 form.")
     1000      (p "The SRFI 58 form '#<dimensions>...' is unsupported.")
     1001
     1002      (p "Doesn't print full SRFI 58 form.")
    10021003    )
    10031004
     
    10111012
    10121013    (history
    1013       (version "3.1.0" "Bug fix for SRFI-63 prototype names & more SRFI-58 support.")
    1014       (version "3.001" "Bug fix for SRFI-63 prototype names.")
     1014      (version "3.1.0" "Bug fix for SRFI 63 prototype names & more SRFI 58 support.")
     1015      (version "3.001" "Bug fix for SRFI 63 prototype names.")
    10151016      (version "3.0" "Bug fix for dimensions of 0 - these should result in an empty array - and not be treated as a synonym of dimension 1. Added 'array-dimensions-object' & 'array-shape-object'.")
    1016       (version "2.117" "Added SRFI-17 support.")
     1017      (version "2.117" "Added SRFI 17 support.")
    10171018      (version "2.116" "Added 'array-prototype'.")
    10181019      (version "2.115" "'array' can now return an empty array with dimensions. Added 'array-length'.")
  • release/3/array-lib/trunk/array-lib-sem.scm

    r9531 r9544  
    99;; a user will create any new storage definitions BEFORE threading.
    1010
    11 (use srfi-1 srfi-4 lolevel)
    12 (use misc-extn-list)
    13 
    1411(eval-when (compile)
    1512  (declare
     
    1714    (import
    1815      current-array-bounds-check
    19       current-array-element-check)
     16      current-array-element-check )
    2017    (bound-to-procedure
    21       arr$find-storedef)
     18      arr$find-storedef )
    2219    (export
    2320      ;; Internal API
     
    2926      arr$*builtin-storedef-list*     ; immutable
    3027      ;
     28      arr$error/type/element
    3129      arr$error/type/array
    32       #;arr$error/type/procedure
    33       #;arr$error/type/symbol
     30      arr$error/type/procedure
     31      arr$error/type/symbol
    3432      arr$error/type/dimensionality
    3533      arr$error/bounds
     
    105103      A:fixN8b
    106104      A:bool
    107       ac64
    108       ac32
    109       ar64
    110       ar32
    111       as64
    112       as32
    113       as16
    114       as8
    115       au64
    116       au32
    117       au16
    118       au8
    119       at1
    120       ;DEPRECATED
    121105      a:floc128b
    122106      a:floc64b
     
    138122      a:fixn16b
    139123      a:fixn8b
    140       a:bool) ) )
     124      a:bool
     125      ac64
     126      ac32
     127      ar64
     128      ar32
     129      as64
     130      as32
     131      as16
     132      as8
     133      au64
     134      au32
     135      au16
     136      au8
     137      at1 ) ) )
     138
     139(use srfi-1 srfi-4 lolevel)
     140(use misc-extn-list)
    141141
    142142;;;
     
    149149;; Always false.
    150150
    151 (define false (constantly #f))
     151(define false (lambda _ #f))
    152152
    153153;;
     
    204204;;; Error Procedures
    205205;;;
     206
     207(define (arr$error/type/element loc . args)
     208  (abort (make-exn-array-type-condition loc "invalid element" args)) )
    206209
    207210(define (arr$error/type/array loc . args)
     
    615618                   (let ([bnd (car shp)])
    616619                     (and (arr$index-in-bound? idx bnd)
    617                           (loop (cdr shp) (cdr idxs)) ) ) ) )]) ) )
     620                          (loop (cdr shp) (cdr idxs)) ) ) ) ) ] ) ) )
    618621
    619622;;;
     
    631634(define (arr$ec-no-empty-arrays . arrs)
    632635  (filter
    633     (lambda (arr)
    634       (let ([len (arr$length arr)])
    635         (unless len
    636           (arr$error/type/array 'ec arr))
    637         (< 0 len)))
    638     arrs) )
     636   (lambda (arr)
     637     (let ([len (arr$length arr)])
     638       (unless len
     639         (arr$error/type/array 'ec arr))
     640       (< 0 len) ) )
     641   arrs) )
    639642
    640643;;;
     
    666669        [else                     ; Try special case
    667670          (or (func dim)
    668               (arr$error/type/dimensionality loc dim))]) )
     671              (arr$error/type/dimensionality loc dim)) ] ) )
    669672
    670673;; Returns a plain list shape form given an argument form
     
    684687          '()]
    685688        [else
    686           (arr$error/type/dimensionality loc dims)]) )
     689          (arr$error/type/dimensionality loc dims) ] ) )
    687690
    688691;; Process 'rest arguments' shape/etc. form
     
    715718              (loop (cons rnk dims)
    716719                    (- rnk 1)
    717                     (* rnk fact))]) ) ) )
     720                    (* rnk fact)) ] ) ) ) )
    718721
    719722;;;
     
    974977                          siz
    975978                          (loop (cdr nlens) (cdr nscls)
    976                                 (* siz (car nlens))
    977979                                #; ;NO ZERO DIMENSIONS
    978980                                (let ([len (car nlens)])
    979981                                  (if (or (= 0 len) (= 0 (car nscls)))  ; 0 length dimension?
    980982                                      siz
    981                                       (* siz len) ) ) ) ) )])
     983                                      (* siz len) ) )
     984                                (* siz (car nlens)) ) ) )])
    982985              ; Make mapped array
    983986              (arr$make-array nshp nscls noff
     
    995998(define (make-prototype-checker name pred? creator)
    996999  (lambda args
    997     (switch (length args)
    998       [0 (creator)]
    999       [1 (let ([init (car args)])
    1000             (if (pred? init)
    1001                 (creator init)
    1002                 (arr$error 'make-prototype-checker "incompatible element type" name init)))]
     1000    (case (length args)
     1001      [(0)
     1002       (creator)]
     1003      [(1)
     1004       (let ([init (car args)])
     1005         (if (pred? init)
     1006             (creator init)
     1007             (arr$error/type/element 'make-prototype-checker name init) ) ) ]
    10031008      [else
    1004         (arr$error 'make-prototype-checker "too many arguments" name args)])))
     1009        (arr$error 'make-prototype-checker "too many arguments" name args) ] ) ) )
     1010
     1011;; Complex
    10051012
    10061013;;@args z
    10071014;;@args
    10081015;;Returns an inexact 128 bit floatingpoint complex uniform-array prototype.
     1016
    10091017(define A:floC128b (make-prototype-checker 'A:floC128b complex? vector))
     1018
    10101019;;@args z
    10111020;;@args
    10121021;;Returns an inexact 64 bit floatingpoint complex uniform-array prototype.
     1022
    10131023(define A:floC64b (make-prototype-checker 'A:floC64b complex? vector))
     1024
    10141025;;@args z
    10151026;;@args
    10161027;;Returns an inexact 32 bit floatingpoint complex uniform-array prototype.
     1028
    10171029(define A:floC32b (make-prototype-checker 'A:floC32b complex? vector))
     1030
    10181031;;@args z
    10191032;;@args
    10201033;;Returns an inexact 16 bit floatingpoint complex uniform-array prototype.
     1034
    10211035(define A:floC16b (make-prototype-checker 'A:floC16b complex? vector))
    10221036
     1037;; Real
     1038
    10231039;;@args z
    10241040;;@args
    10251041;;Returns an inexact 128 bit floatingpoint real uniform-array prototype.
     1042
    10261043(define A:floR128b (make-prototype-checker 'A:floR128b real? vector))
     1044
    10271045;;@args z
    10281046;;@args
    10291047;;Returns an inexact 64 bit floatingpoint real uniform-array prototype.
     1048
    10301049(define A:floR64b (make-prototype-checker 'A:floR64b real? f64vector))
     1050
    10311051;;@args z
    10321052;;@args
    10331053;;Returns an inexact 32 bit floatingpoint real uniform-array prototype.
     1054
    10341055(define A:floR32b (make-prototype-checker 'A:floR32b real? f32vector))
     1056
    10351057;;@args z
    10361058;;@args
    10371059;;Returns an inexact 16 bit floatingpoint real uniform-array prototype.
     1060
    10381061(define A:floR16b (make-prototype-checker 'A:floR16b real? f32vector))
    10391062
     1063;; Rational
     1064
    10401065;;@args z
    10411066;;@args
    10421067;;Returns an exact 128 bit decimal rational uniform-array prototype.
     1068
    10431069(define A:floQ128d (make-prototype-checker 'A:floQ128d exact-rational? vector))
     1070
    10441071;;@args z
    10451072;;@args
    10461073;;Returns an exact 64 bit decimal rational uniform-array prototype.
     1074
    10471075(define A:floQ64d (make-prototype-checker 'A:floQ64d exact-rational? vector))
     1076
    10481077;;@args z
    10491078;;@args
    10501079;;Returns an exact 32 bit decimal rational uniform-array prototype.
     1080
    10511081(define A:floQ32d (make-prototype-checker 'A:floQ32d exact-rational? vector))
     1082
     1083;; Exact
    10521084
    10531085;;@args n
     
    10551087;;Returns an exact binary exact integer uniform-array prototype with at least
    10561088;;64 bits of precision.
     1089
    10571090(define A:fixZ64b (make-prototype-checker 'A:fixZ64b signed-integer-64? vector))
     1091
    10581092;;@args n
    10591093;;@args
    10601094;;Returns an exact binary exact integer uniform-array prototype with at least
    10611095;;32 bits of precision.
     1096
    10621097(define A:fixZ32b (make-prototype-checker 'A:fixZ32b signed-integer-32? s32vector))
     1098
    10631099;;@args n
    10641100;;@args
    10651101;;Returns an exact binary exact integer uniform-array prototype with at least
    10661102;;16 bits of precision.
     1103
    10671104(define A:fixZ16b (make-prototype-checker 'A:fixZ16b signed-integer-16? s16vector))
     1105
    10681106;;@args n
    10691107;;@args
    10701108;;Returns an exact binary exact integer uniform-array prototype with at least
    10711109;;8 bits of precision.
     1110
    10721111(define A:fixZ8b (make-prototype-checker 'A:fixZ8b signed-integer-8? s8vector))
     1112
     1113;; Exact Natural
    10731114
    10741115;;@args k
     
    10761117;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10771118;;least 64 bits of precision.
     1119
    10781120(define A:fixN64b (make-prototype-checker 'A:fixN64b unsigned-integer-64? vector))
     1121
    10791122;;@args k
    10801123;;@args
    10811124;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10821125;;least 32 bits of precision.
     1126
    10831127(define A:fixN32b (make-prototype-checker 'A:fixN32b unsigned-integer-32? u32vector))
     1128
    10841129;;@args k
    10851130;;@args
    10861131;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10871132;;least 16 bits of precision.
     1133
    10881134(define A:fixN16b (make-prototype-checker 'A:fixN16b unsigned-integer-16? u16vector))
     1135
    10891136;;@args k
    10901137;;@args
    10911138;;Returns an exact non-negative binary exact integer uniform-array prototype with at
    10921139;;least 8 bits of precision.
     1140
    10931141(define A:fixN8b (make-prototype-checker 'A:fixN8b unsigned-integer-8? u8vector))
    10941142
     1143;; Boolean
     1144
    10951145;;@args bool
    10961146;;@args
    10971147;;Returns a boolean uniform-array prototype.
     1148
    10981149(define A:bool (make-prototype-checker 'A:bool boolean? vector))
    10991150
    1100 ;; SRFI-47 names
    1101 
    1102 (define ac64 a:floc64b)
    1103 (define ac32 a:floc32b)
    1104 (define ar64 a:flor64b)
    1105 (define ar32 a:flor32b)
    1106 (define as64 a:fixz64b)
    1107 (define as32 a:fixz32b)
    1108 (define as16 a:fixz16b)
    1109 (define as8 a:fixz8b)
    1110 (define au64 a:fixn64b)
    1111 (define au32 a:fixn32b)
    1112 (define au16 a:fixn16b)
    1113 (define au8 a:fixn8b)
    1114 (define at1 a:bool)
    1115 
    1116 ;; array-lib names ;DEPRECATED
    1117 
    1118 (define a:floc128b A:floC128b)
    1119 (define a:floc64b A:floC64b)
    1120 (define a:floc32b A:floC32b)
    1121 (define a:floc16b A:floC16b)
    1122 (define a:flor128b A:floR128b)
    1123 (define a:flor64b A:floR64b)
    1124 (define a:flor32b A:floR32b)
    1125 (define a:flor16b A:floR16b)
    1126 (define a:floq128b A:floQ128d)
    1127 (define a:floq64b A:floQ64d)
    1128 (define a:floq32b A:floQ32d)
    1129 (define a:fixz64b A:fixZ64b)
    1130 (define a:fixz32b A:fixZ32b)
    1131 (define a:fixz16b A:fixZ16b)
    1132 (define a:fixz8b A:fixZ8b)
    1133 (define a:fixn64b A:fixN64b)
    1134 (define a:fixn32b A:fixN32b)
    1135 (define a:fixn16b A:fixN16b)
    1136 (define a:fixn8b A:fixN8b)
    1137 (define a:bool A:bool)
     1151;; Lowercase names
     1152
     1153(define a:floc128b  A:floC128b)
     1154(define a:floc64b   A:floC64b)
     1155(define a:floc32b   A:floC32b)
     1156(define a:floc16b   A:floC16b)
     1157(define a:flor128b  A:floR128b)
     1158(define a:flor64b   A:floR64b)
     1159(define a:flor32b   A:floR32b)
     1160(define a:flor16b   A:floR16b)
     1161(define a:floq128b  A:floQ128d)
     1162(define a:floq64b   A:floQ64d)
     1163(define a:floq32b   A:floQ32d)
     1164(define a:fixz64b   A:fixZ64b)
     1165(define a:fixz32b   A:fixZ32b)
     1166(define a:fixz16b   A:fixZ16b)
     1167(define a:fixz8b    A:fixZ8b)
     1168(define a:fixn64b   A:fixN64b)
     1169(define a:fixn32b   A:fixN32b)
     1170(define a:fixn16b   A:fixN16b)
     1171(define a:fixn8b    A:fixN8b)
     1172(define a:bool      A:bool)
     1173
     1174;; SRFI 47 names
     1175
     1176(define ac64  a:floc64b)
     1177(define ac32  a:floc32b)
     1178(define ar64  a:flor64b)
     1179(define ar32  a:flor32b)
     1180(define as64  a:fixz64b)
     1181(define as32  a:fixz32b)
     1182(define as16  a:fixz16b)
     1183(define as8   a:fixz8b)
     1184(define au64  a:fixn64b)
     1185(define au32  a:fixn32b)
     1186(define au16  a:fixn16b)
     1187(define au8   a:fixn8b)
     1188(define at1   a:bool)
  • release/3/array-lib/trunk/array-lib-syn.scm

    r9531 r9544  
    3838
    3939(define-inline (->boolean obj)
    40   (and obj #t) )
     40  (and obj
     41       #t) )
    4142
    4243;; Array storage definition record
     
    9293#; ;UNUSED
    9394(define-inline (arr$range-empty? l h)
    94   #;
    95   (= l h)
    96   (or (= l h)
    97       (< h l) ) )
     95  (= l h) )
    9896
    9997;; Bounds object (closed interval)
     
    112110#; ;UNUSED
    113111(define-inline (arr$bounds-empty? bnds)
    114   (arr$range-empty? (arr$bounds-low bnds) (arr$bounds-high bnds)) )
     112  (let ([h (arr$bounds-high bnds)])
     113    (or (= -1 h)
     114        (arr$range-empty? (arr$bounds-low bnds) h) ) ) )
    115115
    116116;; Calculate number of elements in a closed interval (bounds object)
     
    121121;; Closed interval (bounds object) -> open interval (a list)
    122122
     123#; ;NO ZERO DIMENSIONS
     124(define-inline (arr$bounds->interval bnds)
     125  (let ([l (arr$bounds-low bnds)]
     126        [h (arr$bounds-high bnds)])
     127    (list l (if (arr$range-empty? l h) h (+ h 1))) ) )
     128
    123129(define-inline (arr$bounds->interval bnds)
    124130  (list (arr$bounds-low bnds) (+ (arr$bounds-high bnds) 1)) )
     
    126132;; Open interval -> closed interval (bounds object)
    127133
     134#; ;NO ZERO DIMENSIONS
     135(define-inline (arr$interval->bounds l h)
     136  (arr$make-bounds l (if (arr$range-empty? l h) h (- h 1))) )
     137
    128138(define-inline (arr$interval->bounds l h)
    129139  (arr$make-bounds l (- h 1)) )
     
    132142
    133143(define-inline (arr$index-in-bound? idx bnds)
     144  (<= (arr$bounds-low bnds) idx (arr$bounds-high bnds))
     145  #;
    134146  (and (<= (arr$bounds-low bnds) idx)
    135147       (let ([h (arr$bounds-high bnds)])
     
    154166;; when necessary. i.e. this will state the length
    155167;; of an empty array is 1!
     168
     169#; ;NO ZERO DIMENSIONS
     170(define-inline (arr$lengths->length lens)
     171  ; Inlined version of
     172  ; (reduce (lambda (tot len) (if (= 0 len) tot (* tot len))) 1 lens)
     173  (let loop ([lens lens]
     174             [tot 1])
     175    (if (null? lens)
     176        tot
     177        (loop (cdr lens)
     178              (let ([len (car lens)])
     179                (if (= 0 len)
     180                    tot
     181                    (* tot len)))) ) ) )
    156182
    157183(define-inline (arr$lengths->length lens)
     
    166192  (let loop ([shp shp] [lens '()])
    167193    (if (null? shp)
    168       (reverse! lens)
    169       (loop (cdr shp) (cons (arr$bounds-length (car shp)) lens)) ) ) )
     194        (reverse! lens)
     195        (loop (cdr shp) (cons (arr$bounds-length (car shp)) lens)) ) ) )
    170196
    171197;; Calculate the number of linear elements for a shape
     
    187213(define-inline (arr$ref storedef arr idxs)
    188214  (if (arr$array? arr)
    189     ((arr$storedef-ref storedef) (arr$array-store arr) (arr$array-store-index arr idxs))
    190     ((arr$storedef-ref storedef) arr (car idxs))))
     215      ((arr$storedef-ref storedef) (arr$array-store arr) (arr$array-store-index arr idxs))
     216      ((arr$storedef-ref storedef) arr (car idxs))))
    191217
    192218;; Backend array element set!
     
    194220(define-inline (arr$set! storedef arr obj idxs)
    195221  (if (arr$array? arr)
    196     ((arr$storedef-set storedef) (arr$array-store arr) (arr$array-store-index arr idxs) obj)
    197     ((arr$storedef-set storedef) arr (car idxs) obj)))
     222      ((arr$storedef-set storedef) (arr$array-store arr) (arr$array-store-index arr idxs) obj)
     223      ((arr$storedef-set storedef) arr (car idxs) obj)))
    198224
    199225;; Perform type check query.
  • release/3/array-lib/trunk/array-lib.html

    r9531 r9544  
    152152<div class="section">
    153153<h3>Description</h3>
    154 <p>Provides a SRFI-63 workalike</p></div>
     154<p>Provides a SRFI 63 workalike</p></div>
    155155<div class="section">
    156156<h3>Usage</h3><tt>(require-extension array-lib)</tt></div>
     
    158158<h3>Requires</h3>
    159159<ul>
    160 <li><a href="http://www.call-with-current-continuation.org/eggs/srfi-42.html">SRFI-42</a></li>
     160<li><a href="http://www.call-with-current-continuation.org/eggs/srfi-42.html">SRFI 42</a></li>
    161161<li><a href="http://www.call-with-current-continuation.org/eggs/misc-extn.html">misc-extn</a></li>
    162162<li><a href="http://www.call-with-current-continuation.org/eggs/miscmacros.html">miscmacros</a></li></ul></div>
     
    165165<div class="section">
    166166<h3>Documentation</h3>
    167 <p>The array-lib purports to be a Chicken workalike for <a href="http://srfi.schemers.org/srfi-47/srfi-47.html">SRFI-47</a>, <a href="http://srfi.schemers.org/srfi-63/srfi-63.html">SRFI-63</a>, and the SLIB array, subarray &amp; arraymap modules.</p>
    168 <div class="subsection">
    169 <h4>SRFI-63 Discussion</h4>
    170 <p>The signatures of all SRFI-63 procedures are supported by this API, only with extended interpretations.</p>
    171 <p>However, unlike SRFI-63, the <tt>equal?</tt> procedure is <em>not</em> automatically rebound! An extension, <tt>array-lib-equal</tt>, is available that provides a rebound procedure.</p>
    172 <p>Both SRFI-47 and SRFI-63 array prototype procedures are supplied, including complex prototypes (see below).</p>
    173 <p>Array constructors will return the underlying storage object, rather than an array object, when the constructed array is 0-origin &amp; rank = 1, per SRFI-63.</p>
     167<p>The array-lib purports to be a Chicken workalike for <a href="http://srfi.schemers.org/srfi-47/srfi-47.html">SRFI 47</a>, <a href="http://srfi.schemers.org/srfi-63/srfi-63.html">SRFI 63</a>, <a href="http://srfi.schemers.org/srfi-58/srfi-58.html">SRFI 58</a>, and the SLIB array, subarray &amp; arraymap modules.</p>
     168<div class="subsection">
     169<h4>Discussion</h4>
     170<p>The signatures of all SRFI 63 procedures are supported by this API, only with extended interpretations.</p>
     171<p>However, unlike SRFI 63, the <tt>equal?</tt> procedure is <em>not</em> automatically rebound! An extension, <tt>array-lib-equal</tt>, is available that provides a rebound procedure.</p>
     172<p>The SRFI 58 &quot;sharp A&quot; forms are supported.</p>
     173<p>Both SRFI 47 and SRFI 63 array prototype procedures are supplied, including complex prototypes (see below).</p>
     174<p>Array constructors will return the underlying storage object, rather than an array object, when the constructed array is 0-origin &amp; rank = 1, per SRFI 63.</p>
    174175<p>The array-lib operations are in general thread-safe. See <code>array:thread-safe</code> and <code>array:storage-definition</code> below for exceptions.</p></div>
    175176<div class="subsection">
     
    178179<p>A <em>Shape</em> is an ordered sequence of <em>Interval</em>, [lower upper), for each dimension. A shape maybe a list of interval list or a <code>shape</code> object. For example, <code>(0 1) (0 2)</code> is a shape of a rank 2 array, with the <em>bounds</em> of dimension one [0 0] and dimension two [0 1].</p>
    179180<p>The accepted list form of dimensions or shape for procedures taking these as tail arguments is as an 'exploded' list. Each element as an individual argument. For example, <code>(make-array '(1 2) '(-8 -5))</code>, not <code>(make-array '((1 2) (-8 -5)))</code>.</p>
    180 <p>All magnitudes of indices, dimensions, bounds, ranks, intervals <b>are</b> fixnums. Not much of a restiction from SRFI-63, just a clarification.</p>
     181<p>All magnitudes of indices, dimensions, bounds, ranks, intervals <b>are</b> fixnums. Not much of a restiction from SRFI 63, just a clarification.</p>
    181182<p>The dimensions <code>'(2 1 3)</code> are equivalent to the shape <code>'(0 2 0 1 0 3)</code>.</p>
    182 <p>An inner or outer dimension of <code>0</code> will result in an empty array. Per the SRFI-63 implementation.</p></div>
     183<p>An inner or outer dimension of <code>0</code> will result in an empty array. Per the SRFI 63 implementation.</p></div>
    183184<div class="subsection">
    184185<h4>Read Syntax</h4>
    185 <p>A <a href="http://srfi.schemers.org/srfi-10/srfi-10.html">SRFI-10</a> printer and reader is supplied.</p>
     186<p>A <a href="http://srfi.schemers.org/srfi-10/srfi-10.html">SRFI 10</a> printer and reader is supplied.</p>
    186187<p>An array specific read/print syntax is supplied: <code>#&lt;rank&gt;A&lt;elements&gt;</code>, where &lt;rank&gt; is the array dimensionality and &lt;elements&gt; are a rank-nested list consisting of all the elements, in row-major order.</p>
    187 <p>The SRFI-10 print-form preserves the underlying storage model and shape information, unlike the #nA form, which only preserves the rank and element values. So, reading the #nA form may not reconstruct the original array.</p>
     188<p>The SRFI 10 print-form preserves the underlying storage model and shape information, unlike the #nA form, which only preserves the rank and element values. So, reading the #nA form may not reconstruct the original array.</p>
    188189<p>Use <code>(current-array-print-form ...)</code> to select the desired form.</p>
    189190<p>A limit is placed on the number of array elements printed, which may be overridden. See <code>(current-array-print-count ...)</code>.</p></div>
     
    201202<dd>
    202203<p>Gets or sets the number of array elements to print. A <tt>COUNT</tt> of <code>#f</code> will set the count 0, and <code>#t</code> will set the count to a very big number. When <tt>COUNT</tt> is a number it must a zero or positive fixnum.</p></dd>
    203 <dt class="definition"><strong>parameter:</strong> (current-array-print-form [FORM 'SRFI-10])</dt>
    204 <dd>
    205 <p>Gets or sets the format for printing an array, either <code>'SRFI-10</code>, <code>'A</code>, or <code>#f</code> which turns off array element printing.</p></dd>
     204<dt class="definition"><strong>parameter:</strong> (current-array-print-form [FORM 'SRFI 10])</dt>
     205<dd>
     206<p>Gets or sets the format for printing an array, either <code>'SRFI 10</code>, <code>'A</code>, or <code>#f</code> which turns off array element printing.</p></dd>
    206207<dt class="definition"><strong>procedure:</strong> (array:thread-safe [FLAG])</dt>
    207208<dd>
     
    269270<dt class="definition"><strong>procedure:</strong> (array? ARRAY)</dt>
    270271<dd>
    271 <p>Returns whether the object is an array object, or accepted as an array. Builtin objects are vector, string, and <a href="http://srfi.schemers.org/srfi-4/srfi-4.html">SRFI-4</a> vectors.</p></dd>
     272<p>Returns whether the object is an array object, or accepted as an array. Builtin objects are vector, string, and <a href="http://srfi.schemers.org/srfi-4/srfi-4.html">SRFI 4</a> vectors.</p></dd>
    272273<dt class="definition"><strong>procedure:</strong> (array-strict? ARRAY)</dt>
    273274<dd>
     
    396397<div class="subsection">
    397398<h4>Accessors</h4>
    398 <p>SRFI-17 is supported.</p>
     399<p>SRFI 17 is supported.</p>
    399400<dt class="definition"><strong>procedure:</strong> (array-ref ARRAY INDEX ...)</dt>
    400401<dd>
     
    526527<div class="subsection">
    527528<h4>Prototypes</h4>
    528 <p>SRFI-63</p>
     529<p>SRFI 63</p>
    529530<dt class="definition"><strong>procedure:</strong> (A:floC128b [INITIAL])</dt>
    530531<dd>
     
    587588<dd>
    588589<p>Returns a boolean uniform-array prototype.</p></dd>
    589 <p>SRFI-47</p>
     590<p>SRFI 47</p>
    590591<dt class="definition"><strong>procedure:</strong> (ac64 [INITIAL])</dt>
    591592<dd>
     
    667668<div class="section">
    668669<h3>Issues</h3>
    669 <p>SRFI-25 indexing is 2.4 times faster! However, 'array-lib' has faster indexing than the reference SRFI-63 implementation.</p>
     670<p>SRFI 25 indexing is 2.4 times faster! However, 'array-lib' has faster indexing than the reference SRFI 63 implementation.</p>
    670671<p>Array aggregate operations are implemented in an element by element fashion.</p>
    671 <p>The SRFI-42 general dispatcher <code>(: ...)</code> does not recognize arrays.</p>
     672<p>The SRFI 42 general dispatcher <code>(: ...)</code> does not recognize arrays.</p>
    672673<p>The 128-bit &amp; 64-bit prototypes are currently implemented as unpacked vectors.</p>
    673 <p>Full SRFI-58 implementation except for the '#&lt;dimensions&gt;...' form.</p>
    674 <p>Doesn't print full SRFI-58 form.</p></div>
     674<p>Full SRFI 58 implementation except for the '#&lt;dimensions&gt;...' form.</p>
     675<p>Doesn't print full SRFI 58 form.</p></div>
    675676<div class="section">
    676677<h3>Examples</h3>
     
    692693(list-&gt;array 2 '#() '((1 2) (3 4)))  ; =&gt; #2A((1 2) (3 4))
    693694(list-&gt;array 0 '#() 3)
    694 ;Note vector returned, per SRFI-63      ; =&gt; #(3)
     695;Note vector returned, per SRFI 63      ; =&gt; #(3)
    695696
    696697(array-&gt;list (array '(2 3) 'ho 'ho 'ho 'ho 'oh 'oh)) ; =&gt; ((ho ho ho) (ho oh oh))
     
    771772<h3>Version</h3>
    772773<ul>
    773 <li>3.1.0 Bug fix for SRFI-63 prototype names &amp; more SRFI-58 support.</li>
    774 <li>3.001 Bug fix for SRFI-63 prototype names.</li>
     774<li>3.1.0 Bug fix for SRFI 63 prototype names &amp; more SRFI 58 support.</li>
     775<li>3.001 Bug fix for SRFI 63 prototype names.</li>
    775776<li>3.0 Bug fix for dimensions of 0 - these should result in an empty array - and not be treated as a synonym of dimension 1. Added 'array-dimensions-object' &amp; 'array-shape-object'.</li>
    776 <li>2.117 Added SRFI-17 support.</li>
     777<li>2.117 Added SRFI 17 support.</li>
    777778<li>2.116 Added 'array-prototype'.</li>
    778779<li>2.115 'array' can now return an empty array with dimensions. Added 'array-length'.</li>
  • release/3/array-lib/trunk/array-lib.scm

    r9531 r9544  
    11211121              (display #\) out) ]
    11221122            ['A
     1123              ;FIXME need full SRFI 58 output form
    11231124              (let ([rnk (length shp)])
    11241125                (display "#" out) (write rnk out) (display #\A out)
    1125                 (when (= 0 rnk)
    1126                   (display #\space out))
     1126                (when (= 0 rnk) (display #\space out))
    11271127                (array-print arr (current-array-print-count) out shp) ) ] ) )
    11281128        ; else not printing array info
  • release/3/array-lib/trunk/tests/array-lib-test.scm

    r9531 r9544  
    194194  )
    195195
    196   (test/case "O Dimension" (
    197       [arr1 (make-array '#(#f) 2 1 3)]
     196  (test/case "O Dimension" (warn "0 Dimensions unsupported - Test WILL Fail") (
     197      [arr1 (make-array '#(#f) 2 0 3)]
    198198      [arr2 (make-array '#(#f) 0 2 3)]
    199199      [arr3 (make-array '#(#f) 2 3 0)] )
Note: See TracChangeset for help on using the changeset viewer.