示例#1
0
文件: core.py 项目: fengb/mal-zig
def macro_Q(args): return wrap_tf(types._function_Q(args[0]) and args[0].ismacro)


# String functions
def pr_str(args):
示例#2
0
文件: core.py 项目: fengb/mal-zig
def function_Q(args): return wrap_tf(types._function_Q(args[0]) and not args[0].ismacro)
def macro_Q(args): return wrap_tf(types._function_Q(args[0]) and args[0].ismacro)
示例#3
0
文件: core.py 项目: fengb/mal-zig
 'false?':
 types._false_Q,
 'number?':
 types._number_Q,
 'string?':
 types._string_Q,
 'symbol':
 types._symbol,
 'symbol?':
 types._symbol_Q,
 'keyword':
 types._keyword,
 'keyword?':
 types._keyword_Q,
 'fn?':
 lambda x: (types._function_Q(x) and not hasattr(x, '_ismacro_')),
 'macro?':
 lambda x:
 (types._function_Q(x) and hasattr(x, '_ismacro_') and x._ismacro_),
 'pr-str':
 pr_str,
 'str':
 do_str,
 'prn':
 prn,
 'println':
 println,
 'readline':
 lambda prompt: mal_readline.readline(prompt),
 'read-string':
 reader.read_str,
示例#4
0
文件: core.py 项目: chasets/mal.x
    return atm.val


ns = { 
        '=': types._equal_Q,
        'throw': throw,
        'nil?': types._nil_Q,
        'true?': types._true_Q,
        'false?': types._false_Q,
        'number?': types._number_Q,
        'string?': types._string_Q,
        'symbol': types._symbol,
        'symbol?': types._symbol_Q,
        'keyword': types._keyword,
        'keyword?': types._keyword_Q,
        'fn?': lambda x: (types._function_Q(x) and not hasattr(x, '_ismacro_')),
        'macro?': lambda x: (types._function_Q(x) and
                             hasattr(x, '_ismacro_') and
                             x._ismacro_),

        'pr-str': pr_str,
        'str': do_str,
        'prn': prn,
        'println': println,
        'readline': lambda prompt: mal_readline.readline(prompt),
        'read-string': reader.read_str,
        'slurp': lambda file: open(file).read(),
        '<':  lambda a,b: a<b,
        '<=': lambda a,b: a<=b,
        '>':  lambda a,b: a>b,
        '>=': lambda a,b: a>=b,
示例#5
0
文件: core.py 项目: kanaka/mal
    return atm.val


ns = { 
        '=': types._equal_Q,
        'throw': throw,
        'nil?': types._nil_Q,
        'true?': types._true_Q,
        'false?': types._false_Q,
        'number?': types._number_Q,
        'string?': types._string_Q,
        'symbol': types._symbol,
        'symbol?': types._symbol_Q,
        'keyword': types._keyword,
        'keyword?': types._keyword_Q,
        'fn?': lambda x: (types._function_Q(x) and not hasattr(x, '_ismacro_')),
        'macro?': lambda x: (types._function_Q(x) and
                             hasattr(x, '_ismacro_') and
                             x._ismacro_),

        'pr-str': pr_str,
        'str': do_str,
        'prn': prn,
        'println': println,
        'readline': lambda prompt: mal_readline.readline(prompt),
        'read-string': reader.read_str,
        'slurp': lambda file: open(file).read(),
        '<':  lambda a,b: a<b,
        '<=': lambda a,b: a<=b,
        '>':  lambda a,b: a>b,
        '>=': lambda a,b: a>=b,