How to resolve the algorithm ISBN13 check digit step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm ISBN13 check digit step by step in the PicoLisp programming language

Table of Contents

Problem Statement

Validate the check digit of an ISBN-13 code:

You might use the following codes for testing:

Show output here, on this page

Let's start with the solution:

Step by Step solution about How to resolve the algorithm ISBN13 check digit step by step in the PicoLisp programming language

Source code in the picolisp programming language

(de isbn13? (S)
   (let L
      (make
         (for N (chop S)
            (and (format N) (link @)) ) )
      (and
         (= 13 (length L))
         (=0 (% (sum * L (circ 1 3)) 10)) ) ) )
(mapc
   '((A)
      (tab
         (-19 1)
         A
         (if (isbn13? A) 'ok 'fail) ) )
   (quote
      "978-1734314502"
      "978-1734314509"
      "978-1-86197-876-9"
      "978-2-74839-908-5"
      "978 1 86197 876 9" ) )

  

You may also check:How to resolve the algorithm Sequence of primes by trial division step by step in the ATS programming language
You may also check:How to resolve the algorithm Greatest common divisor step by step in the Dyalect programming language
You may also check:How to resolve the algorithm Pascal's triangle step by step in the Tcl programming language
You may also check:How to resolve the algorithm Executable library step by step in the Python programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Brlcad programming language