(define spec-form-signature
  (fn
    (form)
    (let
      ((head (symbol-name (first form))) (name (spec-form-name form)))
      (cond
        (or
          (= head "define")
          (= head "defcomp")
          (= head "defisland")
          (= head "defmacro"))
        (let
          ((body (last form)))
          (if
            (and
              (list? body)
              (> (len body) 0)
              (= (type-of (first body)) "symbol")
              (or
                (= (symbol-name (first body)) "fn")
                (= (symbol-name (first body)) "lambda")))
            (let
              ((params (nth body 1)))
              (str "(" head " " name " (fn " (serialize params) " …))"))
            (str "(" head " " name " …)")))
        :else (str "(" head " " name " …)")))))
