chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] (ISBN egg) How is normalize-isbn supposed to be used


From: Christian Kellermann
Subject: Re: [Chicken-users] (ISBN egg) How is normalize-isbn supposed to be used?
Date: Tue, 17 May 2011 09:51:51 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hi Jeronimo,

Thank you for your nice bug report! You have indeed encountered a
bunch of them I hope the experience has not been too discouraging.
To add pain to misery some of the issues you have encountered were
sitting in trunk awaiting a new tag.

So some of your issues are gone now as I have tagged a new version
0.4, please try this one.

* Jeronimo Pellegrini <address@hidden> [110516 21:16]:
> #;1> (use isbn openlibrary)
> #;2> (define isbn "8573261854")
> #;3> (valid-isbn? isbn)
> #;4> (isbn->alist isbn '(title authors))
> => ((title . "Memórias do Subsolo") (authors ("Fiodor Dostoievski")))
> 
> #;5> (normalize-isbn isbn)
> 
> Error: Not a valid length for an isbn: "8573261854"
> 
This has been fixed.

> #;6> (isbn10->isbn13 isbn)
> => "978-8-57326-185-1"

This will return a normalized form since the dashes are totally
bogus as the isbn egg does not lookup the group identifier or
publisher codes and those are variable length (and can be determined
only with a table).

> #;7> (normalize-isbn "978-8-57326-185-1")

This has been fixed.


> Also, is this really supposed to work?
> 
> #;2> (valid-isbn? "blah blah 8573261854")
> #t

This is one of the ugliest parts of the egg. Atm it is stupid and
will throw away all non number chars and checks that.

The proper solution would be to parse the input correctly (either
with a regexp or a "real" parser).  This issue remains unsolved. I
have put it on my list.

However, in the mean time, you could scrub all input that's valid
through normalize:

#;4> (normalize-isbn "blah blah 8573261854")
"8573261854"

normalize itself will check again for validity, so you can rely on
it matching up the pieces.

> 
> It's actually nice if I'm trying to detect the ISBN within
> a line (text converted from PDF, for example), but then
> I can't use it as a valid ISBN as input to the other
> procedures:

I am aware that this is still all a bit messy, thanks for your
input! I will tag 0.5 with a more reliable input parsing "soon".

Does this help you?

Kind regards,

Christian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]