Changeset 16008 in project


Ignore:
Timestamp:
09/21/09 02:32:53 (10 years ago)
Author:
Kon Lovett
Message:

With records what was I thinking!

Location:
release/4/coerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/coerce/trunk/type-coerce.scm

    r16004 r16008  
    3636          chicken
    3737          (only data-structures alist-ref)
    38           (only lolevel record->vector)
    3938          (only srfi-1 every reverse!)
    4039          (only miscmacros if*)
     
    4342          type-of)
    4443
    45   (require-library data-structures lolevel srfi-1
     44  (require-library data-structures srfi-1
    4645                   miscmacros type-checks type-errors type-of)
    4746
    4847;;;
    49 
    50 #; ;NOT YET
    51 (define (vector->record x)
    52   (##sys#check-vector x 'vector->record)
    53   (let* ((n (##sys#size x))
    54                (v (##sys#make-structure/size n)) )
    55     (do ((i 0 (fx+ i 1)))
    56               ((fx>= i n) v)
    57       (##sys#setslot v i (##sys#slot x i)) ) ) )
    5848
    5949(define (string->vector x) (list->vector (string->list x)))
    6050(define (vector->string x) (list->string (vector->list x)))
    61 
    62 #| ;JOKE
    63 (define (record->string x) (vector->string (record->vector x)))
    64 (define (string->record x) (vector->record (string->vector x)))
    65 |#
    6651
    6752;;; Extension
     
    176161              ((list)     (string->list obj) )
    177162              ((vector)   (string->vector obj) )
    178               #; ;JOKE
    179               ((record-instance)
    180                 (record->string obj) )
    181163              (else       (other->other) ) ) )
    182164          ((list)
     
    194176              ((symbol)   (string->symbol (list->string obj)) )
    195177              ((vector)   (list->vector obj) )
    196               #; ;NOT YET
    197               ((record-instance)
    198                 (vector->record (list->vector obj)) )
    199178              (else       (other->other) ) ) )
    200179          ((vector)
     
    212191              ((symbol)   (string->symbol (vector->string obj)) )
    213192              ((list)     (vector->list obj) )
    214               #; ;NOT YET
    215               ((record-instance)
    216                 (vector->record obj) )
    217               (else       (other->other) ) ) )
    218           ((record-instance)
    219             (case restyp
    220               #| ;JOKE
    221               ((atom)     (coerce (record->string obj 'atom) )
    222               ((char)
    223                 (if (and (= 1 (record-instance-length obj)) (char? (record-instance-slot obj 0)))
    224                     (record-instance-slot obj 0)
    225                     (other->other)) )
    226               ((number integer)
    227                (or (string->number (record->string obj)
    228                    (other->other)) )
    229               ((string)   (record->string obj )
    230               ((keyword)  (string->keyword (record->string obj) )
    231               ((symbol)   (string->symbol (record->string obj) )
    232               |#
    233               ((list)     (vector->list (record->vector obj)) )
    234               ((vector)   (record->vector obj) )
    235193              (else       (other->other) ) ) )
    236194          (else
  • release/4/coerce/trunk/type-of.scm

    r16004 r16008  
    4141          chicken
    4242          (only data-structures identity)
    43           (only lolevel record-instance?)
     43          (only lolevel record-instance? record-instance-type)
    4444          (only miscmacros if*)
    4545          (only type-checks check-procedure check-symbol)
     
    6666        ((pair? obj)              'pair)
    6767        ((vector? obj)            'vector)
    68         ((record-instance? obj)   'record-instance)
     68        ((record-instance? obj)   (record-instance-type obj))
    6969        ((eq? (void) obj)         'unspecified)
    7070        (else
Note: See TracChangeset for help on using the changeset viewer.