Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 489 Bytes

README.md

File metadata and controls

26 lines (21 loc) · 489 Bytes

From list to string

Recall the ^ operator to concatenate strings:

# "ping" ^ "pong";;
- : string = "pingpong"

Write a function with the following type:

string_of_list : int list -> string

such that string_of_list l evaluates to a string representation of the list of integers l.

For instance, we must obtain:

# string_of_list [];;
- : string = "[]"

# string_of_list [1];;
- : string = "[1]"

# string_of_list [1;2;3];;
- : string = "[1;2;3]"