Small updates

This commit is contained in:
Matthieu Dubuget 2021-05-24 11:02:34 +02:00
parent ad72fdeb0b
commit c50e512184
5 changed files with 11 additions and 38 deletions

View File

@ -3,11 +3,11 @@ Nombres
Convert ints into french. 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://leconjugueur.lefigaro.fr/frlesnombres.php
- https://www.miakinen.net/vrac/nombres - https://www.miakinen.net/vrac/nombres
- https://www.dcode.fr/ecriture-nombre-lettres - 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).

View File

@ -1,5 +1,5 @@
let rec parse_and_print () = let rec parse_and_print () =
print_string "Entier ? > "; print_string "Entier (Ou [Q]uitter [H]elp) ? > ";
flush stdout; flush stdout;
input_line stdin |> function input_line stdin |> function
| "q" | "Q" -> () | "q" | "Q" -> ()

View File

@ -1,4 +1,4 @@
(lang dune 2.0) (lang dune 2.8)
(generate_opam_files true) (generate_opam_files true)
(name nombres) (name nombres)

View File

@ -45,12 +45,12 @@ and jusqua_100 dizaine n =
and jusqua_1000 n = and jusqua_1000 n =
let centaine = n / 100 and reste = n mod 100 in let centaine = n / 100 and reste = n mod 100 in
let cent = if centaine > 1 && reste = 0 then "cents" else "cent" 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 centaine = 1 then [ cent ] else [ nombre_of_int centaine; cent ])
@ if reste = 0 then [] else [ nombre_of_int reste ] ) @ if reste = 0 then [] else [ nombre_of_int reste ])
|> String.concat " " |> String.concat " "
and jusqua_1000000 n = and jusqua_1000000 n =
let milliers = n / 1000 and reste = n mod 1000 in let milliers = n / 1000 and reste = n mod 1000 in
( (if milliers = 1 then [ "mille" ] else [ nombre_of_int milliers; "mille" ]) ((if milliers = 1 then [ "mille" ] else [ nombre_of_int milliers; "mille" ])
@ if reste = 0 then [] else [ nombre_of_int reste ] ) @ if reste = 0 then [] else [ nombre_of_int reste ])
|> String.concat " " |> String.concat " "

View File

@ -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}
]
]