summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2009-01-22 02:46:23 +0100
committerGuillaume Seguin <guillaume@segu.in>2009-01-22 02:46:23 +0100
commit7863a821ac696ef3364930d89ab422b670d4e854 (patch)
tree38b64c9aa43ebffa00d497ec55c138d033abf41f
parent52aa6220aba4c6444991f98648a2e9723d7ba7f1 (diff)
downloadpetitcaml-7863a821ac696ef3364930d89ab422b670d4e854.tar.gz
petitcaml-7863a821ac696ef3364930d89ab422b670d4e854.tar.bz2
[petitcaml] Improve motif_tuple_folder
-rw-r--r--utils.ml9
1 files changed, 6 insertions, 3 deletions
diff --git a/utils.ml b/utils.ml
index c702109..20f7a71 100644
--- a/utils.ml
+++ b/utils.ml
@@ -34,15 +34,18 @@ let format_binop = function
| OGt -> "OGt"
| OGe -> "OGe"
+let motif_tuple_folder folder_func base motif =
+ Printf.sprintf "%s, %s" base (folder_func motif)
+
let rec format_motif m =
match m.m with
| Munderscore -> "Munderscore _"
| Mident id -> Printf.sprintf "Mident %s" id
| Mtuple (m::motifs) ->
- List.fold_left motif_tuple_folder (format_motif m) motifs
+ let base = format_motif m
+ in
+ List.fold_left (motif_tuple_folder format_motif) base motifs
| Mtuple [] -> "" (* Avoids an useless warning *)
-and motif_tuple_folder base motif =
- Printf.sprintf "%s, %s" base (format_motif motif)
(* Helper pour l'indentation, crée une string de `level` espaces de long *)
let make_indent level =