Jump to content

ISBN13 check digit: Difference between revisions

add PicoLisp
(add PicoLisp)
Line 282:
978-2-74839-908-5: bad
978 1 86197 876 9: good
</pre>
 
=={{header|PicoLisp}}==
<lang PicoLisp>(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" ) )</lang>
{{out}}
<pre>
978-1734314502 ok
978-1734314509 fail
978-1-86197-876-9 ok
978-2-74839-908-5 fail
978 1 86197 876 9 ok
</pre>
 
298

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.