1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
open Fmt

type t =
  | Atom of string
  | List of t list

let rec pp_sexp fmt = function
  | Atom str -> pf fmt "%s" str
  | List [] -> pf fmt "()"
  | List (_ as l) ->
    pf fmt "@[<b>(%a)@]" (list ~sep:(fun fmt () -> pf fmt "@ ") pp_sexp) l