This is based on https://github.com/robrich/sequencify, but modified to use a WeakMap.
972203
function sequence ( map, components, results, missing, recursive, nest ) {
  components.forEach( component => {
    if ( results.indexOf( component ) !== -1 ) {
      return; // de-dup results
    }

    const deps = map.get( component );

    if ( ! deps ) {
      missing.push( component );
    } else if ( nest.indexOf( component ) > -1 ) {
      nest.push( component );
      recursive.push( nest.slice(0) );
      nest.pop( component );
    } else if ( deps.length ) {
      nest.push( component );
      sequence( map, deps, results, missing, recursive, nest ); // recurse
      nest.pop( component );
    }
    results.push( component );
  });
}
1213578
function makeMap (
  str,
  expectsLowerCase
) {
  const map = Object.create(null);
  const list = str.split(',');
  for (let i = 0; i < list.length; i++) {
    map[list[i]] = true;
  }
  return expectsLowerCase
    ? val => map[val.toLowerCase()]
    : val => map[val]
}
1226058
@Override
    public Object mapSequence(Object sequence) {
        List<?> list = (List<?>) sequence;
        List<Object> ret = new ArrayList<>();
        for (Object o : list)
            ret.add(map(o));
        return ret;
    }
29939
@Override
    public Object mapSequence(Object sequence) {
        List<?> seq = (List<?>) sequence;
        List<Object> out = new ArrayList<>();
        for (Object step : seq) {
            out.add(map(step));
        }
        return out;
    }
1229237
function (seq) {
    if (!seq) {
      return [];
    } else if (seq instanceof Array) {
      return seq;
    } else if (isStoreCursor(seq)) {
      return seq.fetch();
    } else {
      throw badSequenceError();
    }
  }
859388
def consume_seqreg(self, seqreg):
        """"""
        if not isinstance(seqreg, tag.directive.Directive) or \
                seqreg.type != 'sequence-region':
            raise ValueError('expected ##sequence-region directive')
        if seqreg.seqid in self.declared_regions:
            msg = 'duplicate sequence region "{}"'.format(seqreg.seqid)
            raise ValueError(msg)
        self.declared_regions[seqreg.seqid] = seqreg.range.copy()
819800
@Override
    public Object mapSequence(Object sequence) {
        List<List<Integer>> seq = (List<List<Integer>>) sequence;
        List<Integer> ret = new ArrayList<>();
        for (List<Integer> step : seq)
            ret.add((Integer) map(step));
        return ret;
    }
1108055
private Object writeMapSimple(SerIterator itemIterator) {
        Map<String, Object> result = new LinkedHashMap<>();
        StringConverter<Object> keyConverter = settings.getConverter().findConverterNoGenerics(itemIterator.keyType());
        while (itemIterator.hasNext()) {
            itemIterator.next();
            Object key = itemIterator.key();
            if (key == null) {
                throw new IllegalArgumentException("Unable to write map key as it cannot be null");
            }
            String str = keyConverter.convertToString(itemIterator.key());
            if (str == null) {
                throw new IllegalArgumentException("Unable to write map key as it cannot be a null string");
            }
            result.put(str, writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator));
        }
        return result;
    }
424350
public void sampleSequenceRepeatedly(SequenceModel model, int numSamples) {
    int[] sequence = getRandomSequence(model);
    sampleSequenceRepeatedly(model, sequence, numSamples);
  }
90241
function pluck(seq, attr) {
        return map(seq, function(value) {
            return objp(value)?  value[attr]
                 : /* nil? */    undefined })
    }
1036692
function _loadRecursive(container, map, accum = {}) {
  return Bluebird.reduce(Object.keys(map), (memo, key) => {
    const path = map[key];
    if (typeof path === 'string') {
      return container._load(path)
        .then((mod) => {
          set(memo, key, mod);
          return memo;
        });
    }
    return _loadRecursive(container, path)
      .then((mods) => {
        set(memo, key, mods);
        return memo;
      });
  }, accum);
}
744040
private static Map<String, Object> convert(
        final Map<CharSequence, Object> params) {
        final Map<String, Object> map = new HashMap<>(params.size());
        for (final Map.Entry<CharSequence, Object> ent : params.entrySet()) {
            map.put(ent.getKey().toString(), ent.getValue());
        }
        return map;
    }
74283
function seq() {
    var fn;
    var t = this;
    for (var i = 0; i < arguments.length; i++) {
        fn = arguments[i];
        t = fn.call(t);
        if (!t)
            return false;
    }
    return this;
}
917429
def fromkeys(cls, seq, value=None, **kwargs):
        
        other = cls(**kwargs)
        other.update(((key, value) for key in seq))

        return other
157097
private static synchronized Map<String, String> getReverseNucleotideTemplateMap(
      String notationSource) {
    Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    Map<String, String> normalMap = nucleotideTemplates.get(notationSource);
    if (normalMap != null) {
      Set<String> set = normalMap.keySet();
      for (Iterator i = set.iterator(); i.hasNext();) {
        String tmp = (String) i.next();
        map.put(normalMap.get(tmp), tmp);
      }
    }
    return map;
  }
1168701
function Sequence(iterable) {
    this.sequence = null;
    this._size = 0;
    this.nodeMap = new rMap();
    if (iterable) {
      if (typeof iterable.length === 'number') {
        for (var i = 0; i < iterable.length; i++) {
          this.add.apply(this, iterable[i]);
        }
      } else if (typeof iterable.entries === 'function') {
        var it = iterable.entries();
        while (!it.done) {
          var tmp = it.next();
          this.add.apply(this, tmp);//it.next());
        }
      }
    }
  }
1328092
def ordered_uniqify(sequence):
    

    items = set()
    return [key for key in sequence if key not in items and not items.add(key)]