Example #1
0
def do_atom(args):
    return MalAtom(args[0])
Example #2
0
 "pr-str": strings(make_str=True),
 "str": strings("", False, True),
 "prn": print_(),
 "println": print_(" ", False),
 "list": list_fn,
 "list?": lambda *x: type(x[0]) == MalList and x[0].opener == '(',
 "empty?": lambda *x: len(x[0]) == 0,
 "count": count,
 "=": lambda x, y: x == y,
 "<": lambda x, y: x < y,
 "<=": lambda x, y: x <= y,
 ">": lambda x, y: x > y,
 ">=": lambda x, y: x >= y,
 "read-string": read_str,
 "slurp": slurp,
 "atom": lambda x: MalAtom(x),
 "atom?": lambda x: type(x) == MalAtom,
 "deref": lambda x: x.value,
 "reset!": reset,
 "swap!": swap,
 "cons": cons,
 "concat": concat,
 "vec": vec,
 "nth": nth,
 "first": lambda x: x[0] if x is not None and len(x) > 0 else None,
 "rest": rest,
 "throw": throw,
 "apply": apply,
 "map": map_,
 "nil?": lambda x: x is None,
 "true?": lambda x: x is True,
Example #3
0
 "<":
 MalFunctionCompiled(lambda args: less(args[0], args[1])),
 "<=":
 MalFunctionCompiled(lambda args: less_equal(args[0], args[1])),
 ">":
 MalFunctionCompiled(lambda args: less(args[1], args[0])),
 ">=":
 MalFunctionCompiled(lambda args: less_equal(args[1], args[0])),
 "read-string":
 MalFunctionCompiled(lambda args: read_string(args[0])),
 "slurp":
 MalFunctionCompiled(lambda args: slurp(args[0])),
 "str":
 MalFunctionCompiled(lambda args: core_str(args)),
 "atom":
 MalFunctionCompiled(lambda args: MalAtom(args[0])),
 "atom?":
 MalFunctionCompiled(lambda args: MalBoolean(isinstance(args[0], MalAtom))),
 "deref":
 MalFunctionCompiled(lambda args: deref_q(args[0])),
 "reset!":
 MalFunctionCompiled(lambda args: reset(args[0], args[1])),
 "cons":
 MalFunctionCompiled(lambda args: cons(args[0], args[1])),
 "concat":
 MalFunctionCompiled(concat),
 "not":
 MalFunctionCompiled(lambda args: not_(args[0])),
 "nth":
 MalFunctionCompiled(lambda args: nth(args[0], args[1])),
 "apply":
Example #4
0
 def test_step6_atom_type(self):
     atom = step6_file.EVAL(MalAtom(MalInt(1)), Env(None))
     self.assertEqual(1, atom.native().native())