 createFunction = (tag, behavior) ->
   (msg) ->
     switch msg
-      when sType then sNumber
+      when sType then sFunction
       when sBoolify then (x, y) -> x
       when sTag then tag
       when sBehavior then behavior

createSymbol = (value) ->
  (msg) ->
    switch msg
      when sType then sValue
      when sName then value
      when sBoolify then (x, y) -> x


# corresponding boxed value.

defInitial = (name, value) ->
  if typeof name == 'string'
    name = new Symbol name
  allocate 1, mem_global, (addrs, mem2) ->
    env_global = update env_global, name, (car addrs)
    mem_global = update mem2, (car addrs), value

defPrimitive = (name, arity, value) ->
  defInitial name, allocate 1, mem_global, (addrs, mem2) ->
    mem_global = expandStore (car addrs), mem2
    createFunction (car addrs), (values, mem, kont) ->
      if (eq arity, (length values))
        value values, mem, kont
      else
        throw new LispInterpreterError "Wrong arity for #{name}"
