def read_atom(reader:Reader): token = reader.next() print(token) if token.isnumeric(): return mytypes.MalNumber(float(token)) elif token[0] == "\"": return mytypes.MalString(read_str_(token)) elif token[0] == ":": return mytypes.MalKeyword(token[1:]) elif token == "true": return mytypes.MalBool(True) elif token == "false": return mytypes.MalBool(False) elif token == "nil": return mytypes.MalNil() else: return mytypes.MalSymbol(token)
def fn_atom_q(a): return mytypes.MalBool(a.my_type == "atom")
def fn_lte(a, b): return mytypes.MalBool(a.content <= b.content)
def fn_gte(a, b): return mytypes.MalBool(a.content >= b.content)
def fn_equal(a, b): return mytypes.MalBool((a.content == b.content) and (a.my_type == b.my_type))
def fn_empty_q(a): return mytypes.MalBool(len(a.content) == 0)
def fn_list_q(a): return mytypes.MalBool(a.my_type == "list")