diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index b2f703e3..f82a0df4 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -53,7 +53,14 @@ let rec serialize_value = function | Symbol s -> s | Keyword k -> ":" ^ k | List items | ListRef { contents = items } -> - "(list " ^ String.concat " " (List.map serialize_value items) ^ ")" + (* Lists with a symbol head are call expressions: (fn arg1 arg2). + Lists starting with data values are data: (list 1 2 3). + This distinction matters for the client parser. *) + (match items with + | (Symbol _ | Keyword _) :: _ -> + "(" ^ String.concat " " (List.map serialize_value items) ^ ")" + | _ -> + "(list " ^ String.concat " " (List.map serialize_value items) ^ ")") | Dict d -> let pairs = Hashtbl.fold (fun k v acc -> (Printf.sprintf ":%s %s" k (serialize_value v)) :: acc) d [] in