string F # obj -> string, x E(x) obj. ( : , . "string , .ToString(). , , , : obj, obj." ) , , tolist sexp<obj> ( obj sexp - , ).
string sprintf "%A", . , , :
type 'a sexp =
| E of 'a
| T of ( sexp<'a> * sexp<'a> )
let rec tolist expr =
match expr with
| Null -> [" "]
| E(x) -> [sprintf "%A" x]
| T(l,r) ->
let l = tolist l
let r = tolist r
["("]@(l)@[" . "]@(r)@[")"]