def prime_check(x): ''' if is a variable ''' if isvar(x): ''' return the sequence of prime numbers ''' return condeseq([(eq, x, p)] for p in map(prime, it.count(1))) else: ''' else if is successful then check is prime and if is not then it fails ''' return success if isprime(x) else fail
def check_prime(x): if isvar(x): return condeseq([eq(x, p)] for p in map(prime, it.count(1))) else: return success if isprime(x) else fail
def prime_test(n): if isvar(n): return condeseq([(eq, n, p)] for p in map(prime, it.count(1))) else: return success if isprime(n) else fail
def prime_check(x): if isvar(x): return condeseq([(eq, x, p)] for p in map(prime, it.count(1))) else: return success if isprime(x) else fail
_reify.add((MetaSymbol, dict), _reify_MetaSymbol) def _reify_TheanoClasses(o, s): meta_obj = MetaSymbol.from_obj(o) return reify(meta_obj, s) _reify.add((tt_class_abstractions, dict), _reify_TheanoClasses) _isvar = isvar.dispatch(object) isvar.add((MetaSymbol, ), lambda x: _isvar(x) or (not isinstance(x.obj, Var) and isvar(x.obj))) def operator_MetaSymbol(x): return type(x) def operator_MetaVariable(x): """Get a tuple of the arguments used to construct this meta object. This applies a special consideration for Theano `Variable`s: if it has a non-`None` `owner` with non-`None` `op` and `inputs`, then the `Variable` is more aptly given as the output of `op(inputs)`. Otherwise, considering the `Variable` in isolation, it can be constructed directly using its `type` constructor.