Python syntax in Lisp and Scheme

Edi Weitz edi at agharta.de
Thu Oct 9 07:27:30 EDT 2003


On Thu, 09 Oct 2003 07:43:40 GMT, "Andrew Dalke" <adalke at mindspring.com> wrote:

> What's unicode support like in general for Lisp? [...] But do
> regexps work on unicode strings?

Unicode support isn't part of the CL standard but the standard is
flexible enough to make it easy for implementations to integrate
Unicode characters and strings seamlessly. You've mentioned a couple
of integrations which do that.

As for regex support - that's not a part of the standard either, but
there a couple of libraries available - see

  <http://www.cliki.net/Regular%20Expression>

If the library is written in Lisp (as opposed to being an FFI wrapper
around a C library) you can be fairly sure that it works with Unicode:

  [19]> (code-char 1000)
  #\COPTIC_CAPITAL_LETTER_HORI
  [20]> (defparameter *target* (make-string 2 :initial-element *))
  *TARGET*
  [21]> (cl-ppcre::scan "^(.){2}$" *target*)
  0 ;
  2 ;
  #(1) ;
  #(2)
  [22]> (cl-ppcre::scan `(:greedy-repetition 2 2 ,(code-char 1000)) *target*)
  0 ;
  2 ;
  #() ;
  #()

(This is CL-PPCRE with CLISP.)

Edi.




More information about the Python-list mailing list