(define spec-explore-define
  :effects (io)
  (fn
    (filename def-name)
    (let
      ((source (helper "read-spec-file" filename)))
      (if
        (starts-with? source ";; spec file not found")
        nil
        (let
          ((forms (sx-parse source)) (found nil))
          (for-each
            (fn
              (form)
              (when
                (and (not found) (list? form) (> (len form) 1))
                (let
                  ((name (spec-form-name form)))
                  (when (= name def-name) (set! found {:kind (spec-form-kind form) :effects (spec-form-effects form) :params (spec-form-params form) :source (serialize form) :name name})))))
            forms)
          found)))))
