>>> from Redy.Magic.Classic import cast
    >>> @cast(list)
    >>> def f(x):
    >>>     for each in x:
    >>>         if each % 2:
    >>>             continue
    >>>         yield each
497115
def cast(cast_fn):
    

    def inner(func):
        def call(*args, **kwargs):
            return cast_fn(func(*args, **kwargs))

        functools.update_wrapper(call, func)
        return call

    return inner
23488
def each_open
      self.each { |r, c, _| yield(r, c) if open?(r, c) }
    end
309169
def each_base_nibble
      return to_enum(:each_base_nibble) unless block_given?
      from.name.split('::').reduce Object do |mod, const|
        mod = mod.const_get const
        yield [mod, const]
        mod
      end
    end
644096
def each
      raise Erlang::ImproperListError if improper?
      return to_enum unless block_given?
      list = self
      until list.empty?
        yield(list.head)
        list = list.tail
      end
      return self
    end
756482
def concat(cls, iterables):
    

    def generator():
      for it in iterables:
        for element in it:
          yield element
    return cls(generator())
372960
def itertypes(iterable):
    """"""
    seen = set()
    for entry in iterable:
        if isinstance(entry, tuple):
            for type_ in entry:
                if type_ not in seen:
                    seen.add(type_)
                    yield type_
        else:
            if entry not in seen:
                seen.add(entry)
                yield entry
263727
def declfuncs(self):
    """"""
    for f in self.body:
        if (hasattr(f, '_ctype')
                and isinstance(f._ctype, FuncType)
                and not hasattr(f, 'body')):
            yield f
399190
def randiter(iterable):
    '''
'''

    iter_len = len(iterable)

    for index in xrandrange(iter_len):
        yield iterable[index]
147836
def ffill(iterable):
    
    it = iter(iterable)
    previous = next(it)
    yield previous
    for e in it:
        if e is None:
            yield previous
        else:
            previous = e
            yield e
230818
def each
      callback = lambda do |key, value, _|
        yield [Base.typecast(key).retain.release_on_gc, Base.typecast(value).retain.release_on_gc]
      end
      CF.CFDictionaryApplyFunction(self, callback, nil)
      self
    end
1040454
def each(io)
      if block_given?
        filter = BELParser::ASTFilter.new(
          BELParser::ASTGenerator.new(io),
          *TYPES)
        filter.each do |results|
          yield results
        end
      else
        enum_for(:each, io)
      end
    end
417245
def wrmap(func, iterable, *args):
    ''
    for it in iterable:
        try:
            yield func(it, *args)
        except Exception as e:
            pass
1306758
function(value, attr, fn, model, computed, indices) {
        return fn.call(this, value, attr, model, computed, indices);
      }
24615
function each(collection, fn, scope) {
  var i = 0,
    cont;

  for (i; i < collection.length; i++) {
    cont = fn.call(scope, collection[i], i);
    if (cont === false) {
      break; //allow early exit
    }
  }
}
1081005
def accumulate(iterable, func=operator.add):
    
    it = iter(iterable)
    total = next(it)
    yield total
    for element in it:
        total = func(total, element)
        yield total
572266
def each_attribute # :yields: attribute
      each_value do |val|
        if val.kind_of? Attribute
          yield val
        else
          val.each_value { |atr| yield atr }
        end
      end
    end
356751
def window(iterable, n=2, cast=tuple):
    
    it = iter(iterable)
    win = deque((next(it) for _ in repeat(None, n)), maxlen=n)
    if len(win) < n:
        raise ValueError('Window size was greater than iterable length')
    yield cast(win)
    append = win.append
    for e in it:
        append(e)
        yield cast(win)