 
 
 
+
 (def type-to-sexp (type)
      (match type
             (SimpleType name range)

                (result-first   (fn (expression)
                                    (Pair pattern expression))
                                (sexp-to-expression expression)))
                                (sexp-to-expression pattern))))

(def collect-pairs (list)
     (match list

(def function-arguments-to-sexp (arguments range)
     (List (list-map (fn (name) (Symbol name range)) arguments) range))

(def pattern-to-sexp (pattern)
     (match pattern
            (ConstructorPattern name Empty range)
                (Symbol name range)
            (ConstructorPattern name patterns range)
                (List (Cons (Symbol name range) (list-map pattern-to-sexp patterns)) range)
            (Capture name range)
                (Symbol name range)))

(def match-pair-to-sexp (pair)
     (match pair
            (Pair pattern expression)
               (Cons (pattern-to-sexp pattern)
               (Cons (expression-to-sexp expression) Empty))))

(def expression-to-sexp (expression)
