Hi Julian, Julian Graham <jool...@gmail.com> writes:
> I was doing some auditing of Guile's support for the functionality > required by the R6RS "Standard Libraries" specification, and I noticed > that Guile's character and string APIs are missing support for > title-cased Unicode characters [0]. ...So I added it. > > Find attached a patch (including documentation and unit tests) that > adds title case-related functions as appropriate to the areas of the > system that deal with character case. In particular, the core > character API, SRFI-13, and i18n are affected. Excellent! Overall this looks good to me. A few notes: > From 82052a10da40a6d814ab30a944859c83bb6fe68e Mon Sep 17 00:00:00 2001 > From: Julian Graham <julian.gra...@aya.yale.edu> > Date: Mon, 21 Dec 2009 08:46:49 -0500 > Subject: [PATCH] Improved support for Unicode title case in Guile's string > and character APIs. > > * doc/ref/api-data.texi (Characters): Documentation for `char-title-case?' > and `char-titlecase'. > * doc/ref/api-i18n.texi (Character Case Mapping): Documentation for > `char-locale-titlecase' and `string-locale-titlecase'. Please wrap lines to 80 characters. > +...@deffn {Scheme Procedure} char-title-case? chr > +...@deffnx {C Function} scm_char_title_case_p (chr) > +Return @code{#t} iff @var{chr} is titlecase, else @code{#f}. I’d remove this function altogether because with SRFI-14 one can just use ‘(char-set-contains? char-set:title-case chr)’ if that’s what’s intended. Given the definition of ‘char-set:title-case’, I expect it to be rarely useful, though. What do you think? > +...@rnindex char-titlecase > +...@deffn {Scheme Procedure} char-titlecase chr > +...@deffnx {C Function} scm_char_titlecase (chr) > +Return the titlecase character version of @var{chr} if one exists; > +otherwise return the uppercase version. > +...@end deffn At first I wondered how this would differ from ‘char-upcase’. IIUC it differs in a few cases, namely Dž and the other members of ‘char-set:title-case’. I think it’d be nice to mention at least one example to illustrate the difference. > +SCM_API scm_t_wchar scm_c_titlecase (scm_t_wchar c); I think it should be documented in the manual. > + (pass-if "char-locale-titlecase-Dz" Maybe “char-locale-titlecase Dž”. > + (pass-if "string-locale-titlecase" > + (and (string=? "Tt" (string-locale-titlecase "tt")) Maybe a longer string otherwise it looks as though it were one of these special cases. ;-) Feel free to commit modulo these small things. Thanks, Ludo’.