Changeset 22096 in project


Ignore:
Timestamp:
12/24/10 18:57:07 (9 years ago)
Author:
Christian Kellermann
Message:

isbn: added tests, fixed normalize isbn

Location:
release/4/isbn/trunk
Files:
2 added
1 edited

Legend:

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

    r22095 r22096  
    5454
    5555   (define (normalize-isbn isbn)
    56      (fold string-append ""
    57            (reverse
    58             (map number->string (string->isbn isbn))))))
     56     (let* ((isbn-orig (reverse (string->isbn isbn)))
     57            (isbn
     58             (if (and (= (length isbn-orig) 13)
     59                      (= (car isbn-orig) 10))
     60                 (cons 0 (cdr isbn-orig))
     61                 isbn-orig)))
     62       (fold string-append ""
     63             (map number->string isbn)))))
Note: See TracChangeset for help on using the changeset viewer.