Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Camomile library tutorial/examples?

134 views
Skip to first unread message

Morozov Matvey

unread,
Sep 5, 2009, 5:42:18 PM9/5/09
to caml...@yquem.inria.fr
Dear all,

I am an inexperienced OСaml coder, so my question may seem trivial.

Recently I tried to add some unicode support to my project (for instance I need to convert Cyrillic characters from uppercase to lowercase and vice versa). I found the impressive Camomile library, which should help me to solve my problems. However I had not found any tutorial or even up-to-date (simple!) examples of the library usage. Would you be so kind to point me to a good introduction to Camomile?

With best regards,

Matvey Morozov

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

dmitry grebeniuk

unread,
Sep 6, 2009, 3:41:21 AM9/6/09
to Morozov Matvey, caml...@yquem.inria.fr
> Recently I tried to add some unicode support to my project (for instance I need to convert Cyrillic characters from uppercase to lowercase and vice versa).

I don't know of any good documentation on Camomile, but here is a
code that converts line from terminal to uppercase and lowercase,
assuming that your terminal's encoding is utf8.

===== camotest.ml =====
open Printf
module PREF = CamomileLibrary.Default.Camomile
module CE = PREF.CharEncoding
module CM = PREF.CaseMap.Make(PREF.UTF8)

let _ =
try
while true do printf "> %!";
let line = input_line stdin in
let up = CM.uppercase line
and low = CM.lowercase line
in printf "ORIG : %s\nUPPER: %s\nLOWER: %s\n%!" line up low
done
with
| End_of_file -> ()
===== / camotest.ml =====

$ ocamlfind ocamlc -package camomile -linkpkg camotest.ml -o camotest
$ ./camotest


btw, if you speak russian (as I can guess), you can join the jabber conference
oc...@conference.jabber.ru , some questions are solved faster than via
mail-lists.

dmitry grebeniuk

unread,
Sep 6, 2009, 3:50:03 AM9/6/09
to Morozov Matvey, caml...@yquem.inria.fr
> Recently I tried to add some unicode support to my project (for instance I need to convert Cyrillic characters from uppercase to lowercase and vice versa).

I don't know of any good documentation on Camomile, but here is a


code that converts line from terminal to uppercase and lowercase,
assuming that your terminal's encoding is utf8.

===== camotest.ml =====
open Printf
module PREF = CamomileLibrary.Default.Camomile
module CE = PREF.CharEncoding
module CM = PREF.CaseMap.Make(PREF.UTF8)

let _ =
try
while true do printf "> %!";
let line = input_line stdin in
let up = CM.uppercase line
and low = CM.lowercase line
in printf "ORIG : %s\nUPPER: %s\nLOWER: %s\n%!" line up low
done
with
| End_of_file -> ()
===== / camotest.ml =====

$ ocamlfind ocamlc -package camomile -linkpkg camotest.ml -o camotest
$ ./camotest


btw, if you speak russian (as I can guess), you can join the jabber conference
oc...@conference.jabber.ru , some questions are solved faster than via
mail-lists.

_______________________________________________

0 new messages