 (def list-map (f list)
      (list-foldr (fn (x xs)
                      (Cons (f x) xs))
+                 Empty
+                 list))
+
+(def string-of-char (character)
+     (Cons character Empty))
+
+(def string-concat (a b)
+     (match a
+            Empty       b
+            (Cons x xs) (Cons x (string-concat xs b))))
+
+(def string-join (separator list)
+     (list-foldr (fn (x xs)
+                     (match xs
+                            Empty       x
+                            (Cons _ __) (string-concat (string-concat xs separator) x)))
                  Empty
                  list))
 

(def parse (input)
     (match (parse-expressions input Empty)
            (Pair _ expressions) expressions))

(def string-of-char (character)
     (Cons character Empty))

(def string-concat (a b)
     (match a
            Empty       b
            (Cons x xs) (Cons x (string-concat xs b))))

(def string-join (separator list)
     (list-foldr (fn (x xs)
                     (match xs
                            Empty       x
                            (Cons _ __) (string-concat (string-concat xs separator) x)))
                 Empty
                 list))

(def wrap-in-brackets (string)
     (string-concat (string-of-char 40) (string-concat string (string-of-char 41))))

                         (ParseOut i)
                         ParseEnd)

(def parse-symbol (input)
     (match (read-while atom-character? input)
            (Pair input Empty) (ParseOut input)
            (Pair input name)  (ParseNext input (Symbol name))))

(def parse-list (input parse-expressions)
     (match (parse-expressions input Empty)
            (Pair input expressions) (ParseNext input (List expressions))))

(def parse-expression (input parse-expressions)
     (match input
            Empty       ParseEnd
            (Cons x xs) (match (whitespace? x)
                               True (parse-expression xs parse-expressions)
                  False (match (= x 40)
                               True (parse-list xs parse-expressions)
                  False (match (= x 41)
                               True (ParseOut xs)
                  False (parse-symbol input))))))

(def parse-expressions (input expressions)
     (match (parse-expression input parse-expressions)
