Changeset 22215 in project for release/4/isbn/trunk/isbn.scm


Ignore:
Timestamp:
01/03/11 19:08:08 (10 years ago)
Author:
Christian Kellermann
Message:

isbn: refactor isbn10->isbn13 thanks to alaric

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/isbn/trunk/isbn.scm

    r22174 r22215  
    9696                  isbn))))
    9797   
    98    (define (isbn13->string isbn)
    99      (string-append
    100       (number->string (list-ref isbn 0))
    101       (number->string (list-ref isbn 1))
    102       (number->string (list-ref isbn 2))
    103       "-"
    104       (number->string (list-ref isbn 3))
    105       "-"
    106       (number->string (list-ref isbn 4))
    107       (number->string (list-ref isbn 5))
    108       (number->string (list-ref isbn 6))
    109       (number->string (list-ref isbn 7))
    110       (number->string (list-ref isbn 8))
    111       "-"
    112       (number->string (list-ref isbn 9))
    113       (number->string (list-ref isbn 10))
    114       (number->string (list-ref isbn 11))
    115       "-"
    116       (number->string
    117        (if (= (list-ref isbn 12) 10) 0
    118            (list-ref isbn 12)))))
    119 
    12098   (define (isbn10->isbn13 isbn10-string)
    12199     (and-let* ((isbn10 (string->isbn isbn10-string))
     
    127105                 (append isbn13-sans-checkdigit
    128106                         (list (isbn13-checkdigit isbn13-sans-checkdigit)))))
    129                (isbn13->string isbn13)))
     107               (isbn->string isbn13)))
    130108
    131109
Note: See TracChangeset for help on using the changeset viewer.