'Add a primitive to the set.
:param primitive: callable object or a function.
:parma in_types: list of primitives arguments\' type
:param ret_type: type returned by the primitive.
:param name: alternative name for the primitive instead
of its __name__ attribute.'

def addPrimitive(self, primitive, in_types, ret_type, name=None):

    if (name is None):
        name = primitive.__name__
    prim = Primitive(name, in_types, ret_type)
    assert ((name not in self.context) or (self.context[name] is primitive)), ("Primitives    are    required    to    have    a    unique    name.    Consider    using    the    argument    'name'    to    rename    your    second    '%s'    primitive." % (name,))
    self._add(prim)
    self.context[prim.name] = primitive
    self.prims_count += 1
