From 4d7ed832389f962cf30b47b9a1e715d84ed92845 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Fri, 23 Sep 2022 08:59:06 -0700 Subject: [PATCH] So that's mutual recursion in Ocaml? I like it. Just change "let" to "and" and you're good-to-go. --- implementations/Ocaml/helloworld/bin/main.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/implementations/Ocaml/helloworld/bin/main.ml b/implementations/Ocaml/helloworld/bin/main.ml index fd4a636..0da27c8 100644 --- a/implementations/Ocaml/helloworld/bin/main.ml +++ b/implementations/Ocaml/helloworld/bin/main.ml @@ -19,6 +19,8 @@ let rec joy_to_string jt = | JoyTrue -> "true" | JoyFalse -> "false" | JoyInt i -> string_of_int i - | JoyList el -> "[" ^ String.concat " " (List.map joy_to_string el) ^ "]" + | JoyList el -> "[" ^ expression_to_joy el ^ "]" + +and expression_to_joy el = String.concat " " (List.map joy_to_string el) let () = print_endline (joy_to_string dummy) -- 2.11.0