From c50e512184f15bf91230d2abf73ef3d766d91b9d Mon Sep 17 00:00:00 2001 From: Matthieu Dubuget Date: Mon, 24 May 2021 11:02:34 +0200 Subject: [PATCH] Small updates --- README.md | 10 +++++----- bin/nbr.ml | 2 +- dune-project | 2 +- lib/nombres.ml | 8 ++++---- nombres.opam | 27 --------------------------- 5 files changed, 11 insertions(+), 38 deletions(-) delete mode 100644 nombres.opam diff --git a/README.md b/README.md index ca20268..365f69f 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ Nombres Convert ints into french. -Some references: +Provided as a 1-function library, and a basic command-line utility (`nbr` — will +certainly be renamed to something longer and less likely to name clash). + +More advanced functionnalities could be added when needed. Here are some +references: - https://leconjugueur.lefigaro.fr/frlesnombres.php - https://www.miakinen.net/vrac/nombres - https://www.dcode.fr/ecriture-nombre-lettres - - -Provided as a 1-function library, and a basic command-line utility (`nbr` — will -certainly be renamed to something longer and less likely to name clash). diff --git a/bin/nbr.ml b/bin/nbr.ml index ffdabfc..6dd5298 100644 --- a/bin/nbr.ml +++ b/bin/nbr.ml @@ -1,5 +1,5 @@ let rec parse_and_print () = - print_string "Entier ? > "; + print_string "Entier (Ou [Q]uitter [H]elp) ? > "; flush stdout; input_line stdin |> function | "q" | "Q" -> () diff --git a/dune-project b/dune-project index 793c088..199baac 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,4 @@ -(lang dune 2.0) +(lang dune 2.8) (generate_opam_files true) (name nombres) diff --git a/lib/nombres.ml b/lib/nombres.ml index 247568a..922c0d6 100644 --- a/lib/nombres.ml +++ b/lib/nombres.ml @@ -45,12 +45,12 @@ and jusqua_100 dizaine n = and jusqua_1000 n = let centaine = n / 100 and reste = n mod 100 in let cent = if centaine > 1 && reste = 0 then "cents" else "cent" in - ( (if centaine = 1 then [ cent ] else [ nombre_of_int centaine; cent ]) - @ if reste = 0 then [] else [ nombre_of_int reste ] ) + ((if centaine = 1 then [ cent ] else [ nombre_of_int centaine; cent ]) + @ if reste = 0 then [] else [ nombre_of_int reste ]) |> String.concat " " and jusqua_1000000 n = let milliers = n / 1000 and reste = n mod 1000 in - ( (if milliers = 1 then [ "mille" ] else [ nombre_of_int milliers; "mille" ]) - @ if reste = 0 then [] else [ nombre_of_int reste ] ) + ((if milliers = 1 then [ "mille" ] else [ nombre_of_int milliers; "mille" ]) + @ if reste = 0 then [] else [ nombre_of_int reste ]) |> String.concat " " diff --git a/nombres.opam b/nombres.opam deleted file mode 100644 index 464839e..0000000 --- a/nombres.opam +++ /dev/null @@ -1,27 +0,0 @@ -# This file is generated by dune, edit dune-project instead -opam-version: "2.0" -description: """ -Convert ints into french. - -Some references: -- https://leconjugueur.lefigaro.fr/frlesnombres.php -- https://www.miakinen.net/vrac/nombres -- https://www.dcode.fr/ecriture-nombre-lettres -""" -depends: [ - "dune" {>= "2.0"} -] -build: [ - ["dune" "subst"] {pinned} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -]