(define spec-form-params
  (fn
    (form)
    (if
      (< (len form) 2)
      (list)
      (let
        ((body (nth form (- (len form) 1))))
        (if
          (and
            (list? body)
            (> (len body) 1)
            (= (type-of (first body)) "symbol")
            (or
              (= (symbol-name (first body)) "fn")
              (= (symbol-name (first body)) "lambda")))
          (let
            ((raw-params (nth body 1)))
            (if
              (list? raw-params)
              (map
                (fn
                  (p)
                  (cond
                    (= (type-of p) "symbol")
                    {:type nil :name (symbol-name p)}
                    (and
                      (list? p)
                      (>= (len p) 3)
                      (= (type-of (first p)) "symbol"))
                    {:type (if (and (>= (len p) 3) (= (type-of (nth p 2)) "symbol")) (symbol-name (nth p 2)) nil) :name (symbol-name (first p))}
                    :else {:type nil :name (str p)}))
                raw-params)
              (list)))
          (list))))))
