 ;
 """
 
-
-
-exports.compileTopLevel = (ast) ->
+# API
+
+compileTopLevel = (ast) ->
   compiled = topLevel (ctx = new Context), ast
-    types: values mapMap (__ highlightType, _type), ctx._scope()
-    js: library + compiled
-
-exports.compileExpression = (ast) ->
+  types: values mapMap (__ highlightType, _type), ctx._scope()
+  js: library + compiled
+
+compileExpression = (ast) ->
   compiled = expressionCompile (ctx = new Context), ast
-    types: values mapMap (__ highlightType, _type), ctx._scope()
-    js: compiled
+  types: values mapMap (__ highlightType, _type), ctx._scope()
+  js: compiled
+
+astizeList = (source) ->
+  astize tokenize "(#{source})", -1
+
+astizeExpression = (source) ->
+  astize tokenize source
+
+
+# end of API
+
+# Utils
+
+join = (seq1, seq2) ->
+  seq1.concat seq2
+
+concatMap = (fn, list) ->
+  concat map fn, list
+
+concat = (lists) ->
+  [].concat lists...
+
+id = (x) -> x
+
+map = (fn, list) ->
+  if list then list.map fn else (list) -> map fn, list
+
+allMap = (fn, list) ->
+  all (map fn, list)
+
+all = (list) ->
+  (filter _is, list).length is list.length
+
+filter = (fn, list) ->
+  list.filter fn
+
+partition = (fn, list) ->
+  [(filter fn, list), (filter ((x) -> not (fn x)), list)]
+
+_notEmpty = (x) -> x.length > 0
+
+_is = (x) -> !!x
+
+__ = (fna, fnb) ->
+  (x) -> fna fnb x
+
+# end of Utils
+
+
+
+exports.compileTopLevel = compileTopLevel
+exports.compileExpression = compileExpression
+exports.astizeList = astizeList
+exports.astizeExpression = astizeExpression
 
 # exports.compileModule = (source) ->
 #   """

#     (call_ (token_ 'cons-array'), [x, (arrayToConses xs)])

assignCompile = (ctx, expression, translatedExpression) ->
  if not translatedExpression
    log expression
  if to = ctx._nameExpression()

    ctx.setGroupTranslation()
    {precs, assigns} = patternCompile ctx, to, expression, translatedExpression

    log "ASSIGN #{ctx._name()}", ctx.shouldDefer()
    if ctx.shouldDefer()
      ctx.addDeferred ctx.shouldDefer(), to, expression
      return 'deferred'

    for {name} in definedNames
      if not ctx.arity name
        ctx.addToScope name
    #log "exiting pattern early", pattern, "for", ctx.shouldDefer()
    return {}

  # Check the types
