[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
Re: [Chicken-users] (ISBN egg) How is normalize-isbn supposed to be used?
Tue, 17 May 2011 09:51:51 +0200
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")
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
#;4> (normalize-isbn "blah blah 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
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?