Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

latest changes

  • Loading branch information...
commit 3e22fca72a07e262a193bfac9257b91f45c76e65 1 parent f2047aa
Timothy Baldridge authored
97 clojure/lang.py
@@ -402,10 +402,10 @@ def gen_overloadfn(max_count = 20):
402 402 def gen_polymorph(cg, argc):
403 403 cg.writeln(get_invoke_def(argc))
404 404 cg.indent()
405   - cg.writeln("tp = arg0.type()")
  405 + cg.writeln("tp = arg0.typedef()")
406 406 cg.writeln("if tp in self.dispatches:")
407 407 cg.indent()
408   - cg.writeln("self.dispatches[tp].invoke"+str(argc)+get_arg_list(argc, nil))
  408 + cg.writeln("return self.dispatches[tp].invoke"+str(argc)+get_arg_list(argc, nil))
409 409 cg.dedent()
410 410 cg.writeln("else:")
411 411 cg.indent()
@@ -424,6 +424,7 @@ def gen_polymorphic_fn(max_count = 20):
424 424 cg.writeln("def add(self, tp, fn):")
425 425 cg.indent()
426 426 cg.writeln("self.dispatches[tp] = fn")
  427 + cg.dedent()
427 428 for x in range(1, max_count):
428 429 gen_polymorph(cg, x)
429 430 return cg.end()
@@ -518,16 +519,100 @@ def wrapfn(name, fn):
518 519 cg = CodeGenerator()
519 520 cg.writeln("class _WrapClass_" + str(ccount) + "(AFn):")
520 521 cg.indent()
  522 + cg.writeln("def __init__(self):")
  523 + cg.indent()
  524 + cg.writeln("AFn.__init__(self)")
  525 + cg.dedent()
521 526 argc = len(inspect.getargspec(fn).args)
522 527 cg.writeln(get_invoke_def(argc))
523 528 cg.indent()
524   - cg.writeln(fn.__name__ + get_arg_list(argc, nil))
  529 + cg.writeln("return " + fn.__name__ + get_arg_list(argc, nil))
525 530 cg.dedent()
526 531 cg.dedent()
527 532 cg.writeln("Var(sym(\""+name+"\"), _WrapClass_"+str(ccount)+"())")
528 533 return cg.end()
529 534
530   -def println(x):
531   - print x
532 535
533   -exec wrapfn("println", println)
  536 +class Protocol(Obj):
  537 + def __init__(self, name, fns):
  538 + Var(name, self)
  539 + self.implementors = {}
  540 + def add_implementor(self, tp):
  541 + self.implementors[tp] = tp
  542 + def implements(self, obj):
  543 + if obj.type() in self.implementors:
  544 + return true
  545 + return false
  546 +
  547 +
  548 +
  549 +def protocol(name, funcs):
  550 + Protocol(sym(name), funcs)
  551 + for x in range(len(funcs)):
  552 + Var(sym(funcs[x]), PolymorphicFn())
  553 +
  554 +def extend(polymorph, type, fn):
  555 + poly = lookup(sym(polymorph))
  556 + poly.add(type, fn)
  557 +
  558 +
  559 +
  560 +protocol("ISeqable", ["seq"])
  561 +protocol("ISeq", ["first", "rest"])
  562 +
  563 +
  564 +def seq(obj):
  565 + return lookup(sym("seq")).invoke1(obj)
  566 +
  567 +def first(obj):
  568 + return lookup(sym("first")).invoke1(obj)
  569 +
  570 +def rest(obj):
  571 + return lookup(sym("rest")).invoke1(obj)
  572 +
  573 +class Array(Obj):
  574 + _type = TypeDef("Array")
  575 + def __init__(self, array):
  576 + Obj.__init__(self)
  577 + self.array = array
  578 + def typedef(self):
  579 + return Array._type
  580 +
  581 +class ArraySeq(Obj):
  582 + _type = TypeDef("ArraySeq")
  583 + def __init__(self, array, idx):
  584 + Obj.__init__(self)
  585 + self.idx = idx
  586 + self.array = array
  587 + def typedef(self):
  588 + return ArraySeq._type
  589 +
  590 +def ArraySeq_first(arr):
  591 + return arr.array[arr.idx]
  592 +
  593 +def ArraySeq_rest(arr):
  594 + if arr.idx + 1 >= len(arr.array):
  595 + return nil
  596 + return ArraySeq(arr.array, arr.idx + 1)
  597 +
  598 +def Array_seq(arr):
  599 + return ArraySeq(arr.array, 0)
  600 +
  601 +x = wrapfn("array-seq", Array_seq)
  602 +exec x
  603 +exec wrapfn("first-arrayseq", ArraySeq_first)
  604 +exec wrapfn("rest-arrayseq", ArraySeq_rest)
  605 +
  606 +
  607 +extend("seq", Array._type, lookup(sym("array-seq")))
  608 +extend("first", ArraySeq._type, lookup(sym("first-arrayseq")))
  609 +extend("rest", ArraySeq._type, lookup(sym("rest-arrayseq")))
  610 +
  611 +
  612 +v = Array([1, 2, 3, 4, 5])
  613 +
  614 +s = seq(v)
  615 +
  616 +while s is not nil:
  617 + print first(s)
  618 + s = rest(s)
3  clojure/lang/#rt.py#
... ... @@ -0,0 +1,3 @@
  1 +
  2 +
  3 +
BIN  clojure/lang/__init__.pyc
Binary file not shown
BIN  clojure/lang/afn.pyc
Binary file not shown
77 clojure/lang/afn.py~
... ... @@ -0,0 +1,77 @@
  1 +import string
  2 +
  3 +
  4 +class CodeGeneratorBackend:
  5 + def begin(self, tab="\t"):
  6 + self.code = []
  7 + self.tab = tab
  8 + self.level = 0
  9 + def end(self):
  10 + return string.join(self.code, "")
  11 + def writeln(self, string):
  12 + return self.write(string+"\n")
  13 + def write(self, string):
  14 + self.code.append(self.tab * self.level + string)
  15 + def indent(self):
  16 + self.level = self.level + 1
  17 + def dedent(self):
  18 + import sys
  19 + if self.level == 0:
  20 + raise SyntaxError, "internal error in code generator"
  21 + self.level = self.level - 1
  22 +
  23 +
  24 +def gen_invoke(cg, argc):
  25 + arglist = ["self"]
  26 + for x in range(argc):
  27 + arglist.append("arg"+str(x))
  28 + cg.writeln("def invoke" + str(argc)+"(" + ", ".join(arglist) +"):")
  29 + cg.indent()
  30 + cg.writeln("raise Exception('bad arity ' + str(" + str(argc)+"))")
  31 + cg.dedent()
  32 +
  33 +def gen_apply_block(cg, argc, evalstr = ".evaluate()"):
  34 + cg.writeln("if lst.length().int_value() == " + str(argc) + ":")
  35 + cg.indent()
  36 + args = []
  37 + for x in range(argc):
  38 + cg.writeln("arg" + str(x) + " = lst.first()"+evalstr)
  39 + cg.writeln("lst = lst.rest()")
  40 + args.append("arg" + str(x))
  41 + cg.writeln("return self.invoke"+str(argc)+"(" + ",".join(args)+")")
  42 + cg.dedent()
  43 +
  44 +def gen_applies(cg, max_count = 20):
  45 + cg.writeln("def apply(self, lst):")
  46 + cg.indent()
  47 + cg.writeln("if self.is_builtin().bool_value():")
  48 + cg.indent()
  49 + for x in range(max_count):
  50 + gen_apply_block(cg, x, "")
  51 + cg.dedent()
  52 + cg.writeln("else:")
  53 + cg.indent()
  54 + for x in range(max_count):
  55 + gen_apply_block(cg, x)
  56 + cg.dedent()
  57 +
  58 +def gen_afn(max_count = 20):
  59 + cg = CodeGeneratorBackend()
  60 + cg.begin()
  61 + cg.writeln("# This file is autogenerated.")
  62 + cg.writeln("# DO NOT EDIT!!!!!")
  63 + cg.writeln("from clojure.lang.primitives import Obj")
  64 + cg.writeln("class AFn(Obj):")
  65 + cg.indent()
  66 + for x in range(max_count):
  67 + gen_invoke(cg, x)
  68 + gen_applies(cg, max_count)
  69 + cg.dedent()
  70 + f = open("clojure/lang/afn_gen.py", "w")
  71 + res = cg.end()
  72 + f.write(res)
  73 + return res
  74 +
  75 +gen_afn()
  76 +from clojure.lang.afn_gen import AFn
  77 +
BIN  clojure/lang/afn_gen.pyc
Binary file not shown
BIN  clojure/lang/builtins.pyc
Binary file not shown
105 clojure/lang/builtins.py~
... ... @@ -0,0 +1,105 @@
  1 +from clojure.lang.primitives import Obj, BoolObj
  2 +from clojure.lang.list import List, EmptyList
  3 +from clojure.lang.var import Var, push_frame, Binding, pop_frame
  4 +from clojure.lang.symbol import Symbol
  5 +from clojure.lang.primitives import Obj, IntObj
  6 +
  7 +class RecurInfo(Obj):
  8 + def set_recur(self, recur):
  9 + self._inrecur = recur
  10 + def get_recur(self):
  11 + return self._inrecur
  12 +
  13 +_RecurInfo = RecurInfo()
  14 +
  15 +class UserFn(Obj):
  16 + def __init__(self, bindings, forms):
  17 + self._bindings = bindings
  18 + self._forms = forms
  19 + def evaluate(self):
  20 + return self
  21 + def invoke(self, args):
  22 + res = None
  23 + while True:
  24 + res = self.inner_invoke(args)
  25 + if _RecurInfo.get_recur() is not None:
  26 + args = _RecurInfo.get_recur()
  27 + else:
  28 + break
  29 + _RecurInfo.set_recur(None)
  30 + return res
  31 + def inner_invoke(self, args):
  32 + binds = EmptyList()
  33 + bs = self._bindings
  34 + for x in range(self._bindings.length().int_value()):
  35 + binds = binds.cons(Binding(bs.first(), args[x]))
  36 + bs = bs.rest()
  37 + push_frame(binds)
  38 + form = self._forms
  39 + res = None
  40 + for x in range(len(form)):
  41 + res = form[x].evaluate()
  42 + pop_frame()
  43 + return res
  44 + def is_builtin(self):
  45 + return BoolObj(False)
  46 +
  47 +
  48 +
  49 +class Fn(Obj):
  50 + def __init__(self):
  51 + pass
  52 + def is_builtin(self):
  53 + return BoolObj(True)
  54 + def evaluate(self):
  55 + return self
  56 + def invoke(self, args):
  57 + return UserFn(args[0], args[1:])
  58 +
  59 +class If(Obj):
  60 + def __init__(self):
  61 + pass
  62 + def is_builtin(self):
  63 + return BoolObj(True)
  64 + def evaluate(self):
  65 + return self
  66 + def invoke(self, args):
  67 + res = args[0].evaluate().bool_value()
  68 + if res:
  69 + return args[1].evaluate()
  70 + if len(args) == 2:
  71 + return None
  72 + return args[2].evaluate()
  73 +
  74 +class Def(Obj):
  75 + def __init__(self):
  76 + pass
  77 + def is_builtin(self):
  78 + return BoolObj(True)
  79 + def evaluate(self):
  80 + return self
  81 + def invoke(self, args):
  82 + val = args[1].evaluate()
  83 + return Var(args[0], val)
  84 +
  85 +
  86 +class Recur(Obj):
  87 + def __init__(self):
  88 + pass
  89 + def is_builtin(self):
  90 + return BoolObj(True)
  91 + def evaluate(self):
  92 + return self
  93 + def invoke(self, args):
  94 + nlist = []
  95 + for x in range(len(args)):
  96 + nlist.append(args[x].evaluate())
  97 + _RecurInfo.set_recur(nlist)
  98 + return None
  99 +
  100 +recur = Var(Symbol.from_string("recur"), Recur())
  101 +d = Var(Symbol.from_string("def"), Def())
  102 +fn = Var(Symbol.from_string("fn"), Fn())
  103 +
  104 +ifsym = Var(Symbol.from_string("if"), If())
  105 +
BIN  clojure/lang/lispreader.pyc
Binary file not shown
119 clojure/lang/lispreader.py~
... ... @@ -0,0 +1,119 @@
  1 +from clojure.lang.primitives import IntObj, Obj, StrObj, FloatObj
  2 +from clojure.lang.symbol import Symbol
  3 +from clojure.lang.list import List
  4 +
  5 +_numbers = "1234567890"
  6 +_whitespace = " \t\n\r"
  7 +
  8 +
  9 +class LookAheadReader:
  10 + """description of class"""
  11 + def __init__(self, data):
  12 + self.data = data
  13 + self.head = 0
  14 +
  15 + def next(self):
  16 + self.head += 1
  17 +
  18 + def peek(self):
  19 + return self.data[self.head + 1]
  20 +
  21 + def has_more(self):
  22 + return self.head < len(self.data)
  23 +
  24 + def current(self):
  25 + return self.data[self.head]
  26 +
  27 +class LispReader:
  28 + """Reads Lisp Items"""
  29 +
  30 + def read_char(self, reader):
  31 + """Reads a single character"""
  32 + s = reader.current()
  33 + if (s == '\\'):
  34 + reader.next()
  35 + return reader.current()
  36 + return s
  37 +
  38 + def read_string(self, reader, endquote):
  39 + reader.next()
  40 + chars = []
  41 + while reader.current() != '"':
  42 + chars.append(reader.current())
  43 + reader.next()
  44 + return StrObj("".join(chars))
  45 +
  46 + @staticmethod
  47 + def is_number(chr):
  48 + return chr in _numbers
  49 +
  50 + @staticmethod
  51 + def is_whitespace(chr):
  52 + return
  53 +
  54 + def read_number(self, reader):
  55 + chars = []
  56 + while self.is_number(reader.current()) or \
  57 + reader.current() == '.' or \
  58 + reader.current() == '-':
  59 + chars.append(reader.current())
  60 + reader.next()
  61 + str = "".join(chars)
  62 + if str == "-":
  63 + return Symbol.from_string(str)
  64 + if '.' in str:
  65 + return FloatObj(float(str))
  66 + return IntObj(int(str))
  67 +
  68 + def read_term(self, reader):
  69 + if not reader.has_more():
  70 + return None
  71 +
  72 + while reader.current() in _whitespace:
  73 + reader.next()
  74 + if not reader.has_more:
  75 + return None
  76 +
  77 + cur = reader.current()
  78 +
  79 + if cur == '"':
  80 + return self.read_string(reader, '"')
  81 +
  82 + if self.is_number(cur) or cur == '-':
  83 + return self.read_number(reader)
  84 +
  85 + if cur == '(':
  86 + return self.read_list('(', reader, ')')
  87 +
  88 + if cur == ')':
  89 + return StrObj(cur)
  90 +
  91 + chrs = []
  92 +
  93 +
  94 + while (not reader.current() in _whitespace) \
  95 + and (reader.current() != ')') \
  96 + and (reader.current() != '(') \
  97 + and reader.has_more():
  98 + chrs.append(reader.current())
  99 + reader.next()
  100 + sym = "".join(chrs)
  101 +
  102 + #if sym.strip(_whitespace) == "":
  103 + # return None
  104 +
  105 + return Symbol.intern(StrObj(sym))
  106 +
  107 + def read_list(self, start, reader, end):
  108 + lst = []
  109 + reader.next()
  110 + while True:
  111 + term = self.read_term(reader)
  112 + if term is None:
  113 + raise Exception("EOF wile reading list")
  114 + if isinstance(term, StrObj) and term.str_value() == ")":
  115 + reader.next();
  116 + return List.from_list(lst)
  117 + lst.append(term)
  118 +
  119 +
BIN  clojure/lang/list.pyc
Binary file not shown
110 clojure/lang/list.py~
... ... @@ -0,0 +1,110 @@
  1 +from clojure.lang.primitives import Obj, BoolObj, IntObj
  2 +from clojure.lang.symbol import Symbol
  3 +from clojure.lang.afn import AFn
  4 +
  5 +import sys
  6 +
  7 +class List(Obj):
  8 + def __init__(self, head, tail = None, count = 1):
  9 + self.head = head
  10 + self.tail = tail
  11 + self.count = count
  12 + def cons(self, other):
  13 + if self.count == 0:
  14 + return List(other)
  15 + return List(other, self, self.count + 1)
  16 + def rest(self):
  17 + return self.tail
  18 + def first(self):
  19 + return self.head
  20 + def length(self):
  21 + return IntObj(self.count)
  22 +
  23 + def get_item(self, idx):
  24 + h = self
  25 + for x in range(idx):
  26 + h = h.rest()
  27 + return h.head
  28 +
  29 + def __len__(self):
  30 + return self.count
  31 +
  32 + def __getslice__(self, i, k):
  33 + if k == sys.maxint:
  34 + h = self
  35 + for x in range(i):
  36 + h = self.rest()
  37 + return h
  38 + v = []
  39 + h = self
  40 + for x in range(i):
  41 + h = self.rest()
  42 + for x in range(k-i):
  43 + v.append(h.head)
  44 + return List.from_list(v)
  45 +
  46 + @staticmethod
  47 + def from_list(lst):
  48 + last = None
  49 + count = 1
  50 + for x in range(len(lst)-1, -1, -1):
  51 + last = List(lst[x], last, count)
  52 + count += 1
  53 + return last
  54 +
  55 + def to_list(self):
  56 + lst = [None] * self.count
  57 + idx = 0
  58 + list = self
  59 + while list is not None:
  60 + lst[idx] = list.head
  61 + idx += 1
  62 + list = list.tail
  63 + return lst
  64 +
  65 + def __repr__(self):
  66 + s = []
  67 + s.append("(")
  68 + h = self
  69 + while h is not None:
  70 + s.append(str(h.head))
  71 + h = h.rest()
  72 + s.append(")")
  73 + return " ".join(s)
  74 + def evaluate(self):
  75 + from clojure.jit.jit import jitdriver
  76 + from clojure.lang.var import _Globals
  77 + jitdriver.jit_merge_point(form = self, frames = _Globals._frames )
  78 + f = self.first().evaluate()
  79 + args = []
  80 + h = self.rest()
  81 + return f.apply(h)
  82 +
  83 +
  84 +
  85 +class EmptyList(Obj):
  86 + def __init__(self):
  87 + pass
  88 + def cons(self, head):
  89 + return List(head)
  90 + def rest(self):
  91 + raise Exception("Can't get rest from empty list")
  92 + def first(self):
  93 + raise Exception("EmptyList")
  94 + def __len__(self):
  95 + return 0
  96 + def length(self):
  97 + return IntObj(0)
  98 +
  99 +
  100 +class Cons_List(AFn):
  101 + def invoke2(self, x, lst):
  102 + return lst.cons(x)
  103 +
  104 +
  105 +def init_vars():
  106 + from clojure.lang.var import Var
  107 + conslist = Var(Symbol.from_string("cons_list*"), Cons_List())
  108 +
  109 +init_vars()
  110 +
BIN  clojure/lang/math.pyc
Binary file not shown
37 clojure/lang/math.py~
... ... @@ -0,0 +1,37 @@
  1 +from clojure.lang.var import Var
  2 +from clojure.lang.symbol import Symbol
  3 +from clojure.lang.primitives import Obj, IntObj
  4 +from clojure.lang.afn import AFn
  5 +
  6 +
  7 +class Add(AFn):
  8 + def __init__(self):
  9 + pass
  10 + def evaluate(self):
  11 + return self
  12 + def invoke2(self, arg0, arg1):
  13 + return IntObj(arg0.int_value() + arg1.int_value())
  14 +
  15 +add = Var(Symbol.from_string("+"), Add())
  16 +
  17 +class Sub(AFn):
  18 + def __init__(self):
  19 + pass
  20 + def evaluate(self):
  21 + return self
  22 + def invoke2(self, arg0, arg1):
  23 + return IntObj(arg0.int_value() - arg1.int_value())
  24 +
  25 +sub = Var(Symbol.from_string("-"), Sub())
  26 +
  27 +class Equals(AFn):
  28 + def __init__(self):
  29 + pass
  30 + def evaluate(self):
  31 + return self
  32 + def invoke2(self, arg0, arg1):
  33 + return arg0.equals(arg1)
  34 +
  35 +eq = Var(Symbol.from_string("="), Equals())
  36 +
  37 +
145 clojure/lang/overloadfn_gen.py
... ... @@ -0,0 +1,145 @@
  1 +from clojure.lang.afn_gen import AFn
  2 +class OverloadedFn(AFn):
  3 + _immutable_fields_ = ['fns']
  4 + def __init__(self, fns):
  5 + self.fns = fns
  6 + def invoke0(self):
  7 + if 0 in self.fns:
  8 + AFn.invoke0(self)
  9 + elif -1 in self.fns:
  10 + AFn.apply(self, List.from_list([]))
  11 + else:
  12 + raise Exception("No overload for 0")
  13 + def invoke1(self, arg0):
  14 + if 1 in self.fns:
  15 + AFn.invoke1(self, arg0)
  16 + elif -1 in self.fns:
  17 + AFn.apply(self, List.from_list([arg0]))
  18 + else:
  19 + raise Exception("No overload for 1")
  20 + def invoke2(self, arg0, arg1):
  21 + if 2 in self.fns:
  22 + AFn.invoke2(self, arg0, arg1)
  23 + elif -1 in self.fns:
  24 + AFn.apply(self, List.from_list([arg0,arg1]))
  25 + else:
  26 + raise Exception("No overload for 2")
  27 + def invoke3(self, arg0, arg1, arg2):
  28 + if 3 in self.fns:
  29 + AFn.invoke3(self, arg0, arg1, arg2)
  30 + elif -1 in self.fns:
  31 + AFn.apply(self, List.from_list([arg0,arg1,arg2]))
  32 + else:
  33 + raise Exception("No overload for 3")
  34 + def invoke4(self, arg0, arg1, arg2, arg3):
  35 + if 4 in self.fns:
  36 + AFn.invoke4(self, arg0, arg1, arg2, arg3)
  37 + elif -1 in self.fns:
  38 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3]))
  39 + else:
  40 + raise Exception("No overload for 4")
  41 + def invoke5(self, arg0, arg1, arg2, arg3, arg4):
  42 + if 5 in self.fns:
  43 + AFn.invoke5(self, arg0, arg1, arg2, arg3, arg4)
  44 + elif -1 in self.fns:
  45 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4]))
  46 + else:
  47 + raise Exception("No overload for 5")
  48 + def invoke6(self, arg0, arg1, arg2, arg3, arg4, arg5):
  49 + if 6 in self.fns:
  50 + AFn.invoke6(self, arg0, arg1, arg2, arg3, arg4, arg5)
  51 + elif -1 in self.fns:
  52 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5]))
  53 + else:
  54 + raise Exception("No overload for 6")
  55 + def invoke7(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6):
  56 + if 7 in self.fns:
  57 + AFn.invoke7(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6)
  58 + elif -1 in self.fns:
  59 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6]))
  60 + else:
  61 + raise Exception("No overload for 7")
  62 + def invoke8(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7):
  63 + if 8 in self.fns:
  64 + AFn.invoke8(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
  65 + elif -1 in self.fns:
  66 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7]))
  67 + else:
  68 + raise Exception("No overload for 8")
  69 + def invoke9(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8):
  70 + if 9 in self.fns:
  71 + AFn.invoke9(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
  72 + elif -1 in self.fns:
  73 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8]))
  74 + else:
  75 + raise Exception("No overload for 9")
  76 + def invoke10(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9):
  77 + if 10 in self.fns:
  78 + AFn.invoke10(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
  79 + elif -1 in self.fns:
  80 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9]))
  81 + else:
  82 + raise Exception("No overload for 10")
  83 + def invoke11(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10):
  84 + if 11 in self.fns:
  85 + AFn.invoke11(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
  86 + elif -1 in self.fns:
  87 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10]))
  88 + else:
  89 + raise Exception("No overload for 11")
  90 + def invoke12(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11):
  91 + if 12 in self.fns:
  92 + AFn.invoke12(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)
  93 + elif -1 in self.fns:
  94 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11]))
  95 + else:
  96 + raise Exception("No overload for 12")
  97 + def invoke13(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12):
  98 + if 13 in self.fns:
  99 + AFn.invoke13(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)
  100 + elif -1 in self.fns:
  101 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12]))
  102 + else:
  103 + raise Exception("No overload for 13")
  104 + def invoke14(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13):
  105 + if 14 in self.fns:
  106 + AFn.invoke14(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)
  107 + elif -1 in self.fns:
  108 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13]))
  109 + else:
  110 + raise Exception("No overload for 14")
  111 + def invoke15(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14):
  112 + if 15 in self.fns:
  113 + AFn.invoke15(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14)
  114 + elif -1 in self.fns:
  115 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14]))
  116 + else:
  117 + raise Exception("No overload for 15")
  118 + def invoke16(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15):
  119 + if 16 in self.fns:
  120 + AFn.invoke16(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15)
  121 + elif -1 in self.fns:
  122 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15]))
  123 + else:
  124 + raise Exception("No overload for 16")
  125 + def invoke17(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16):
  126 + if 17 in self.fns:
  127 + AFn.invoke17(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16)
  128 + elif -1 in self.fns:
  129 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16]))
  130 + else:
  131 + raise Exception("No overload for 17")
  132 + def invoke18(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17):
  133 + if 18 in self.fns:
  134 + AFn.invoke18(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17)
  135 + elif -1 in self.fns:
  136 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17]))
  137 + else:
  138 + raise Exception("No overload for 18")
  139 + def invoke19(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18):
  140 + if 19 in self.fns:
  141 + AFn.invoke19(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18)
  142 + elif -1 in self.fns:
  143 + AFn.apply(self, List.from_list([arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18]))
  144 + else:
  145 + raise Exception("No overload for 19")
BIN  clojure/lang/overloadfn_gen.pyc
Binary file not shown
120 clojure/lang/polymorphic_gen.py
... ... @@ -0,0 +1,120 @@
  1 +from clojure.lang.afn_gen import AFn
  2 +class PolymorphicFn(AFn):
  3 + def __init__(self):
  4 + self.dispatches = {}
  5 + def add(self, tp, fn):
  6 + self.dispatches[tp] = fn
  7 + def invoke1(self, arg0):
  8 + tp = arg0.type()
  9 + if tp in self.dispatches:
  10 + self.dispatches[tp].invoke1(arg0)
  11 + else:
  12 + raise Exception("No polymorph for " + tp.__repr__())
  13 + def invoke2(self, arg0, arg1):
  14 + tp = arg0.type()
  15 + if tp in self.dispatches:
  16 + self.dispatches[tp].invoke2(arg0, arg1)
  17 + else:
  18 + raise Exception("No polymorph for " + tp.__repr__())
  19 + def invoke3(self, arg0, arg1, arg2):
  20 + tp = arg0.type()
  21 + if tp in self.dispatches:
  22 + self.dispatches[tp].invoke3(arg0, arg1, arg2)
  23 + else:
  24 + raise Exception("No polymorph for " + tp.__repr__())
  25 + def invoke4(self, arg0, arg1, arg2, arg3):
  26 + tp = arg0.type()
  27 + if tp in self.dispatches:
  28 + self.dispatches[tp].invoke4(arg0, arg1, arg2, arg3)
  29 + else:
  30 + raise Exception("No polymorph for " + tp.__repr__())
  31 + def invoke5(self, arg0, arg1, arg2, arg3, arg4):
  32 + tp = arg0.type()
  33 + if tp in self.dispatches:
  34 + self.dispatches[tp].invoke5(arg0, arg1, arg2, arg3, arg4)
  35 + else:
  36 + raise Exception("No polymorph for " + tp.__repr__())
  37 + def invoke6(self, arg0, arg1, arg2, arg3, arg4, arg5):
  38 + tp = arg0.type()
  39 + if tp in self.dispatches:
  40 + self.dispatches[tp].invoke6(arg0, arg1, arg2, arg3, arg4, arg5)
  41 + else:
  42 + raise Exception("No polymorph for " + tp.__repr__())
  43 + def invoke7(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6):
  44 + tp = arg0.type()
  45 + if tp in self.dispatches:
  46 + self.dispatches[tp].invoke7(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
  47 + else:
  48 + raise Exception("No polymorph for " + tp.__repr__())
  49 + def invoke8(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7):
  50 + tp = arg0.type()
  51 + if tp in self.dispatches:
  52 + self.dispatches[tp].invoke8(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
  53 + else:
  54 + raise Exception("No polymorph for " + tp.__repr__())
  55 + def invoke9(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8):
  56 + tp = arg0.type()
  57 + if tp in self.dispatches:
  58 + self.dispatches[tp].invoke9(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
  59 + else:
  60 + raise Exception("No polymorph for " + tp.__repr__())
  61 + def invoke10(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9):
  62 + tp = arg0.type()
  63 + if tp in self.dispatches:
  64 + self.dispatches[tp].invoke10(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
  65 + else:
  66 + raise Exception("No polymorph for " + tp.__repr__())
  67 + def invoke11(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10):
  68 + tp = arg0.type()
  69 + if tp in self.dispatches:
  70 + self.dispatches[tp].invoke11(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
  71 + else:
  72 + raise Exception("No polymorph for " + tp.__repr__())
  73 + def invoke12(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11):
  74 + tp = arg0.type()
  75 + if tp in self.dispatches:
  76 + self.dispatches[tp].invoke12(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)
  77 + else:
  78 + raise Exception("No polymorph for " + tp.__repr__())
  79 + def invoke13(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12):
  80 + tp = arg0.type()
  81 + if tp in self.dispatches:
  82 + self.dispatches[tp].invoke13(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)
  83 + else:
  84 + raise Exception("No polymorph for " + tp.__repr__())
  85 + def invoke14(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13):
  86 + tp = arg0.type()
  87 + if tp in self.dispatches:
  88 + self.dispatches[tp].invoke14(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)
  89 + else:
  90 + raise Exception("No polymorph for " + tp.__repr__())
  91 + def invoke15(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14):
  92 + tp = arg0.type()
  93 + if tp in self.dispatches:
  94 + self.dispatches[tp].invoke15(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14)
  95 + else:
  96 + raise Exception("No polymorph for " + tp.__repr__())
  97 + def invoke16(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15):
  98 + tp = arg0.type()
  99 + if tp in self.dispatches:
  100 + self.dispatches[tp].invoke16(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15)
  101 + else:
  102 + raise Exception("No polymorph for " + tp.__repr__())
  103 + def invoke17(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16):
  104 + tp = arg0.type()
  105 + if tp in self.dispatches:
  106 + self.dispatches[tp].invoke17(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16)
  107 + else:
  108 + raise Exception("No polymorph for " + tp.__repr__())
  109 + def invoke18(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17):
  110 + tp = arg0.type()
  111 + if tp in self.dispatches:
  112 + self.dispatches[tp].invoke18(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17)
  113 + else:
  114 + raise Exception("No polymorph for " + tp.__repr__())
  115 + def invoke19(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18):
  116 + tp = arg0.type()
  117 + if tp in self.dispatches:
  118 + self.dispatches[tp].invoke19(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18)
  119 + else:
  120 + raise Exception("No polymorph for " + tp.__repr__())
BIN  clojure/lang/polymorphic_gen.pyc
Binary file not shown
BIN  clojure/lang/primitives.pyc
Binary file not shown
105 clojure/lang/primitives.py~
... ... @@ -0,0 +1,105 @@
  1 +class Obj:
  2 + """Base object all other object in PhaLinks inherit this"""
  3 + def __init__(self):
  4 + pass
  5 + def to_str(self):
  6 + return StrObj("UnknownObjType")
  7 + def equals(self, other):
  8 + return BoolObj(False)
  9 + def is_builtin(self):
  10 + return BoolObj(False)
  11 + def __len__(self):
  12 + return 0
  13 +
  14 +class BoolObj(Obj):
  15 + def __init__(self, value):
  16 + self.boolvalue = value
  17 + def bool_value(self):
  18 + return self.boolvalue
  19 + def __repr__(self):
  20 + return "Bool("+str(self.boolvalue)+")"
  21 + def type(self):
  22 + from runtime.symbols import BoolType
  23 + return BoolType
  24 + def to_str(self):
  25 + return str(self.boolvalue)
  26 + def equals(self, other):
  27 + if other.bool_value() == self.bool_value():
  28 + return BoolObj(True)
  29 + else:
  30 + return BoolObj(False)
  31 + return BoolObj(False)
  32 + def evaluate(self):
  33 + return self
  34 +
  35 +class AppendDictObj(Obj):
  36 + def __init__(self, init):
  37 + self.dict = init
  38 +
  39 + def get(self, sym):
  40 + return DictObj._static_get(sym)
  41 +
  42 + @purefunction
  43 + @staticmethod
  44 + def _static_get(d, sym):
  45 + if sym in d:
  46 + return d[sym]
  47 + return None
  48 +
  49 + def assoc(self, sym, value):
  50 + self.dict = self.dict.copy()[sym] = value
  51 +
  52 +@purefunction
  53 +def boolean(v):
  54 + return BoolObj(v)
  55 +
  56 +BoolFalse = boolean(False)
  57 +BoolTrue = boolean(True)
  58 +
  59 +class TypeObj(Obj):
  60 + def __init__(self, value):
  61 + self.typevalue = value
  62 + def type_value(self):
  63 + return self.typevalue
  64 + def __repr__(self):
  65 + return "Type("+str(self.typevalue)+")"
  66 +
  67 +
  68 +class FloatObj(Obj):
  69 + """Represents a integer"""
  70 + def __init__(self, value):
  71 + self.floatvalue = value
  72 + def float_value(self):
  73 + return self.floatvalue
  74 + def __repr__(self):
  75 + return "Float("+str(self.floatvalue)+")"
  76 + def evaluate(self):
  77 + return self;
  78 +
  79 +class IntObj(Obj):
  80 + """Represents a integer"""
  81 + def __init__(self, value):
  82 + self.intvalue = value
  83 + def int_value(self):
  84 + return self.intvalue
  85 + def __repr__(self):
  86 + return "Int("+str(self.intvalue)+")"
  87 + def type(self):
  88 + from runtime.symbols import IntType
  89 + return IntType
  90 + def equals(self, other):
  91 + if other.int_value() == self.int_value():
  92 + return BoolObj(True)
  93 + else:
  94 + return BoolObj(False)
  95 + def evaluate(self):
  96 + return self
  97 +
  98 +class StrObj(Obj):
  99 + """Represents a string"""
  100 + def __init__(self, value):
  101 + self.strvalue = value
  102 + def str_value(self):
  103 + return self.strvalue
  104 + def evaluate(self):
  105 + return self
1  clojure/lang/rt
... ... @@ -0,0 +1 @@
  1 +
BIN  clojure/lang/symbol.pyc
Binary file not shown
48 clojure/lang/symbol.py~
... ... @@ -0,0 +1,48 @@
  1 +from primitives import Obj, StrObj
  2 +
  3 +_symbols = {}
  4 +
  5 +_interned = {}
  6 +
  7 +SymbolType = None
  8 +
  9 +def intern(value):
  10 + if value in _interned:
  11 + return _interned[value]
  12 + _interned[value] = value
  13 + return value
  14 +
  15 +class Symbol(Obj):
  16 + """Defines a symbol. these are basically interned strings"""
  17 + def __init__(self, value):
  18 + self.value = value
  19 +
  20 + @staticmethod
  21 + @purefunction
  22 + def intern(value):
  23 + var = intern(value.str_value())
  24 + if var in _symbols:
  25 + return _symbols[var]
  26 + sym = Symbol(var)
  27 + _symbols[var] = sym
  28 + return sym
  29 +
  30 + @staticmethod
  31 + @purefunction
  32 + def from_string(str):
  33 + return Symbol.intern(StrObj(str))
  34 +
  35 + def type(self):
  36 + return SymbolType
  37 +
  38 + def __repr__(self):
  39 + return "Sym("+self.value+")"
  40 + def evaluate(self):
  41 + from clojure.lang.var import lookup
  42 + return lookup(self).evaluate()
  43 +
  44 +@purefunction
  45 +def sym(str):
  46 + return Symbol.from_string(str)
  47 +
  48 +SymbolType = Symbol.from_string("SymbolType")
104 clojure/lang/type.py~
... ... @@ -0,0 +1,104 @@
  1 +
  2 +from clojure.lang.internal_atom import InternalAtom
  3 +from clojure.lang.symbol import sym
  4 +
  5 +class Type(Obj):
  6 + _immutable_fields_ = ["fields", "name"]
  7 + def __init__(self, name, fields, fns, protocols):
  8 + fields.append(Symbol.intern("meta"))
  9 + self.fields = fields
  10 + self.name = name
  11 + self.fns = InternalAtom(fns)
  12 + self.protocols = InternalAtom(protocols)
  13 +
  14 + def extend(self, name, fn):
  15 + dr = self.fns.deref()
  16 + if name in dr:
  17 + raise Exception("fn " + name.__repr__() + "already implemented")
  18 + self.fns.set(lambda o: o[name] = fn)
  19 +
  20 +
  21 + def extends(self, name)
  22 + proto = self.protocols.deref()
  23 + Type._static_extends(proto, name)
  24 +
  25 + @staticmethod
  26 + @purefunction
  27 + def _static_extends(proto, name):
  28 + if name not in proto:
  29 + return BoolFalse
  30 + return BoolTrue
  31 +
  32 + def get_fn(self, name):
  33 + Type._static_get_fn(name, self.fns.deref())
  34 +
  35 + @staticmethod
  36 + @purefunction
  37 + def _static_get_fn(name, fns):
  38 + if name not in fns:
  39 + return None
  40 + return fns[name]
  41 +
  42 + @purefunction
  43 + def field_count(self):
  44 + return self.fields
  45 +
  46 + @purefunction
  47 + def field_offset(self, sym):
  48 + for x in range(len(self.fields)):
  49 + if fields[x] == sym:
  50 + return x
  51 +
  52 +class Record(Obj):
  53 + _immutable_fields_ = ["tp", "vals"]
  54 + def __init__(self, tp, vals = None):
  55 + if (vals == None):
  56 + vals = [].extend(tp.field_count())
  57 + self.tp = tp
  58 + self.vals = vals
  59 +
  60 + @purefunction
  61 + def assoc(self, sym, val):
  62 + nvals = self.vals[:]
  63 + nvals[tp.field_offset()] = val
  64 + return Record(self.tp, nvals)
  65 +
  66 + @purefunction
  67 + def get(self, sym):
  68 + return self.vals[tp.field_offset()]
  69 +
  70 +class ProtocolRegistry(Obj):
  71 + def __init__(self):
  72 + self.registry = AppendDictObj({})
  73 + def register(self, name, protocol):
  74 + self.registry.assoc(name, protocol)
  75 + def get(self, name):
  76 + return self.registry.get(name)
  77 +
  78 +
  79 +_protocols = ProtocolRegistry()
  80 +
  81 +class Protocol(Obj)
  82 + def __init__(self, name, fns):
  83 + self.name = name
  84 + self.fns = fns
  85 + _protocols.register(name, self)
  86 +
  87 +def gen_type(name, args):
  88 + fields = []
  89 + for x in range(len(args)):
  90 + fields.append(Symbol.intern(args[x]))
  91 + return Type(Symbol.intern(name), fields)
  92 +
  93 +
  94 +def with_meta(obj, m):
  95 + return obj.assoc(sym("meta"), m)
  96 +
  97 +def list_conj(lst, itm):
  98 + return
  99 +
  100 +list_type = gen_type("PersistentList",
  101 + ["count", "first", "rest"]
  102 + {sym("cons"), )
  103 +
  104 +def list_node(
BIN  clojure/lang/var.pyc
Binary file not shown
49 clojure/lang/var.py~
... ... @@ -0,0 +1,49 @@
  1 +from primitives import Obj, StrObj
  2 +from clojure.lang.list import List, EmptyList
  3 +
  4 +_named = {}
  5 +
  6 +_frames = EmptyList()
  7 +
  8 +class Binding:
  9 + def __init__(self, k, v):
  10 + self._k = k
  11 + self._v = v
  12 + def k(self):
  13 + return self._k
  14 + def v(self):
  15 + return self._v
  16 + def __repr__(self):
  17 + return str(self._k) + "->" + str(self._v)
  18 +
  19 +def push_frame(frame):
  20 + global _frames
  21 + _frames = _frames.cons(frame)
  22 +
  23 +def pop_frame():
  24 + global _frames
  25 + _frames = _frames.rest()
  26 +
  27 +def lookup(sym):
  28 + global _frames
  29 + if len(_frames) != 0:
  30 + h = _frames.first()
  31 + while h is not None:
  32 + if (h.first().k() == sym):
  33 + return h.first().v()
  34 + h = h.rest()
  35 + return _named[sym]
  36 +
  37 +
  38 +
  39 +class Var(Obj):
  40 + def __init__(self, name, value):
  41 + self._name = name
  42 + self._value = value
  43 + _named[name] = self
  44 + def evaluate(self):
  45 + return self._value.evaluate()
  46 +
  47 +
  48 +
  49 +
BIN  clojure/lang/wrapfn.pyc
Binary file not shown

0 comments on commit 3e22fca

Please sign in to comment.