OSDN Git Service
(root)
/
joypy
/
Thun.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d717b59
)
So that's mutual recursion in Ocaml?
author
Simon Forman
<sforman@hushmail.com>
Fri, 23 Sep 2022 15:59:06 +0000
(08:59 -0700)
committer
Simon Forman
<sforman@hushmail.com>
Fri, 23 Sep 2022 15:59:06 +0000
(08:59 -0700)
I like it. Just change "let" to "and" and you're good-to-go.
implementations/Ocaml/helloworld/bin/main.ml
patch
|
blob
|
history
diff --git
a/implementations/Ocaml/helloworld/bin/main.ml
b/implementations/Ocaml/helloworld/bin/main.ml
index
fd4a636
..
0da27c8
100644
(file)
--- 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)