Created
December 7, 2013 14:38
-
-
Save gofer/7843026 to your computer and use it in GitHub Desktop.
Print list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* List print for debug *) | |
fun print_list nil = print "nil\n" | |
| print_list (x::xs) = | |
let | |
fun print_list_ nil = "nil" | |
| print_list_ (x::nil) = String.concat([(Int.toString(x)), "\n"]) | |
| print_list_ (x::xs) = String.concat([Int.toString x, ", ", print_list_ xs]) | |
in | |
print (print_list_ (x::xs)) | |
end; | |
print_list nil; | |
(* | |
nil | |
val it = () : unit | |
*) | |
print_list [1, 2, 3, 4, 5]; | |
(* | |
1, 2, 3, 4, 5 | |
val it = () : unit | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment