Sequence ::= SequenceStart WSC SequenceValue? WSC SequenceEnd
        Set := SetStart WSC SequenceValue? WSC SetEnd
        SequenceValue ::= Value (WSC SeparatorSymbol WSC Value)*
178964
def parse_iterable(self, stream, start, end):
        
        values = []

        self.expect(stream, start)
        self.skip_whitespace_or_comment(stream)

        if self.has_next(end, stream):
            self.expect(stream, end)
            return values

        while 1:
            self.skip_whitespace_or_comment(stream)
            values.append(self.parse_value(stream))
            self.skip_whitespace_or_comment(stream)

            if self.has_next(end, stream):
                self.expect(stream, end)
                return values

            self.expect(stream, self.seporator)
1110303
private List<Variable> parseAssignRange(Sequence sequence, TokenList tokens, TokenList.Token t0) {
        // find assignment symbol
        TokenList.Token tokenAssign = t0.next;
        while( tokenAssign != null && tokenAssign.symbol != Symbol.ASSIGN ) {
            tokenAssign = tokenAssign.next;
        }

        if( tokenAssign == null )
            throw new ParseError("Can't find assignment operator");

        // see if it is a sub matrix before
        if( tokenAssign.previous.symbol == Symbol.PAREN_RIGHT ) {
            TokenList.Token start = t0.next;
            if( start.symbol != Symbol.PAREN_LEFT )
                throw new ParseError(("Expected left param for assignment"));
            TokenList.Token end = tokenAssign.previous;
            TokenList subTokens = tokens.extractSubList(start,end);
            subTokens.remove(subTokens.getFirst());
            subTokens.remove(subTokens.getLast());

            handleParentheses(subTokens,sequence);

            List<TokenList.Token> inputs = parseParameterCommaBlock(subTokens, sequence);

            if (inputs.isEmpty())
                throw new ParseError("Empty function input parameters");

            List<Variable> range = new ArrayList<>();
            addSubMatrixVariables(inputs, range);
            if( range.size() != 1 && range.size() != 2 ) {
                throw new ParseError("Unexpected number of range variables.  1 or 2 expected");
            }
            return range;
        }

        return null;
    }
601022
def join_impl(other, join_type, sequence):
    
    if join_type == "inner":
        return inner_join_impl(other, sequence)
    seq_dict = {}
    for element in sequence:
        seq_dict[element[0]] = element[1]
    seq_kv = seq_dict
    other_kv = dict(other)
    if join_type == "left":
        keys = seq_kv.keys()
    elif join_type == "right":
        keys = other_kv.keys()
    elif join_type == "outer":
        keys = set(list(seq_kv.keys()) + list(other_kv.keys()))
    else:
        raise TypeError("Wrong type of join specified")
    result = {}
    for k in keys:
        result[k] = (seq_kv.get(k), other_kv.get(k))
    return six.viewitems(result)
607069
function hoistDeclarations(ast) {
        var sequences = {
            TemplateLiteral: function (x) {
                return x.expressions;
            },
            NewExpression: function (x) {
                return x.arguments;
            },
            CallExpression: function (x) {
                return x.arguments;
            },
            SequenceExpression: function (x) {
                return x.expressions;
            },
            ArrayExpression: function (x) {
                return x.elements;
            },
            ObjectExpression: function (oe) {
                return oe.properties.map(function (p) {
                    return p.value;
                });
            }
        };
        /* Identify SequenceExpressions, Parameter lists and VariableDeclarators that contain assigments and split them up
        to ensure the correct evaluation order */
        function containsAssign(ast) {
            return contains(ast, function (n) {
                return n.type === 'AssignmentExpression';
            });
        }
        
        treeWalk(ast, function (node, descend, path) {
            var i;
            descend();
            // Ensure assigments are evaluated before any await expressions, eg:
            // f(a=1, b = await a) --> a=1; f(a,b=await a)
            function moveAssignments(dest) {
                if (assignments.length) {
                    dest.argument = {
                        type: 'SequenceExpression',
                        expressions: assignments.map(function (a) {
                            var b = cloneNode(a);
                            coerce(a, a.left);
                            return b;
                        }).concat(dest.argument)
                    };
                    assignments = [];
                }
            }
            
            if (node.type in sequences && !node.$hoisted) {
                var expr = sequences[node.type](node);
                var assignments = [];
                var path;
                for (i = 0; i < expr.length; i++) {
                    if (examine(expr[i]).isScope) 
                        continue;
                    if (path = containsAwait(expr[i])) 
                        moveAssignments(path[0].self);
                    if (!containsAwait(expr.slice(i + 1))) 
                        break;
                    if (path = containsAssign(expr[i])) 
                        assignments.push(path[0].self);
                }
            } else if (node.type === 'VariableDeclaration') {
                // If any of the VariableDeclarators contain an initial value and are followed by a VariableDeclarator
                // containing an await, split them up into multiple statements
                for (i = node.declarations.length - 1; i > 0; i--) {
                    if (node.declarations[i] && node.declarations[i].init && containsAwait(node.declarations[i].init)) {
                        var insert = {
                            type: 'VariableDeclaration',
                            kind: node.kind,
                            declarations: node.declarations.splice(i)
                        };
                        var ref = path[0];
                        if ('index' in ref) {
                            ref.parent[ref.field].splice(ref.index + 1, 0, insert);
                        } else 
                            throw new Error("VariableDeclaration not in a block");
                    }
                }
            }
        });
        /* Hoist declarations */
        function isFreeVariable(kinds) {
            return function (n, path) {
                if (n.type === 'VariableDeclaration' && (n.kind = n.kind || 'var') && kinds.indexOf(n.kind) >= 0) {
                    var p = path[0];
                    // Don't hoist the LHS of for (var/let/const _ of/in ... ; ;){}
                    if (p.field == "left" && (p.parent.type === 'ForInStatement' || p.parent.type === 'ForOfStatement')) 
                        return false;
                    // Don't hoist the LHS of for (let/const _ = ... ; ;){}
                    if (p.field == "init" && p.parent.type === 'ForStatement' && (n.kind === "const" || n.kind === "let")) 
                        return false;
                    return true;
                }
            };
        }
        
        function isHoistableFunction(n, path) {
            // YES: We're a named function, but not a continuation
            if (n.type === 'FunctionDeclaration' && n.id) {
                return examine(n).isAsync || !n.$continuation;
            }
            // No, we're not a hoistable function
            return false;
        }
        
        checkConstsNotAssigned(ast);
        var inStrictBody = false;
        treeWalk(ast, function (node, descend, path) {
            var prevScope = inStrictBody;
            inStrictBody = inStrictBody || isStrict(node);
            if (examine(node).isBlockStatement) {
                if (containsAwait(node)) {
                    // For this scope/block, find all the hoistable functions, vars and directives
                	    var isVarScope = !path[0].parent || examine(path[0].parent).isScope  ; 
                	    var isLoopScope = path[0].parent && examine(path[0].parent).isLoop ;
                    var isScope = isVarScope || isLoopScope ;
                    /* 'const' is highly problematic. In early version of Chrome (Node 0.10, 4.x, 5.x) non-standard behaviour:
                     *
                     * Node             scope           multiple-decls
                     * v0.1x            function        SyntaxError
                     * v0.1x strict     SyntaxError     SyntaxError
                     * 4/5.x            function        SyntaxError
                     * 4/5.x strict     block           ok (SyntaxError on duplicate in block)
                     * 6.x  (as 4/5.x strict)
                     *
                     * To make these non-standard behaviours work, we treat a single declaration of a const identifier as requiring function scope (which works everywhere),
                     * declare as a 'var' and initialize inline.
                     * We treat multiple declarations as block-scoped, and let the engine work it out. To make consts blocked-scope, we use 'const' where possible (i.e. before
                     * any await expressions), or declare as 'let' after an await. This breaks in non-strict mode in Node 4/5, as 'let' requires strict mode.
                     *
                     * In summary, what this means is:
                     * - const's with a single declaration in the current scope (NOT block) should be hoisted to function level, and defined as 'var'
                     * - const's with duplicate declarations in the current scope (NOT block) should be hoisted to block level, and defined as 'let'
                     */
                    var directives, consts, vars, lets, functions;
                    if (isScope) {
                        consts = scopedNodes(node, isFreeVariable(['const']), false);
                        var names = {}, duplicates = {};
                        // Work out which const identifiers are duplicates
                        // Ones that are only declared once can simply be treated as vars, whereas
                        // identifiers that are declared multiple times have block-scope and are
                        // only valid in node 6 or in strict mode on node 4/5. 
                        // In strict mode or ES6-a-like targets always assume the correct ES6 semantics (block scope)
                        consts.forEach(function (d) {
                            d[0].self.declarations.forEach(function (e) {
                                getDeclNames(e.id).forEach(function (n) {
                                    if (inStrictBody || looksLikeES6 || names[n] || duplicates[n]) {
                                    	   looksLikeES6 = true ;
                                        delete names[n];
                                        duplicates[n] = e;
                                    } else {
                                        names[n] = e;
                                    }
                                });
                            });
                        });
                        // Change all the declarations into assignments, since consts are always initialized
                        consts.forEach(function (d) {
                            for (var depth = 0;depth < d.length; depth++) 
                                if (examine(d[depth].parent).isBlockStatement) 
                                break;
                            var ref = d[depth];
                            ref.append({
                                type: 'ExpressionStatement',
                                expression: {
                                    type: 'SequenceExpression',
                                    expressions: d[0].self.declarations.map(function (d) {
                                        var a = {
                                            type: 'AssignmentExpression',
                                            operator: '=',
                                            left: d.id,
                                            right: d.init
                                        };
                                        d.init = null;
                                        return a;
                                    })
                                }
                            });
                            var ids = getDeclNames(d[0].self.declarations);
                            var decls = ids.filter(function (name) {
                                return name in duplicates;
                            });
                            if (decls.length) {
                                d[0].append({
                                    type: 'VariableDeclaration',
                                    kind: 'let',
                                    declarations: decls.map(function (name) {
                                        return {
                                            type: 'VariableDeclarator',
                                            id: ident(name)
                                        };
                                    })
                                });
                            }
                            d[0].self.kind = 'var';
                            decls = ids.filter(function (name) {
                                return name in names;
                            });
                            if (decls.length) {
                                d[0].self.declarations = decls.map(function (name) {
                                    return {
                                        type: 'VariableDeclarator',
                                        id: ident(name)
                                    };
                                });
                            } else {
                                ref.remove();
                            }
                        });
                        if (isVarScope && !isLoopScope) vars = scopedNodes(node, isFreeVariable(['var']), ['isScope']);
                        lets = [];
                    } else {
                        lets = scopedNodes(node, isFreeVariable(['const']), true);
                    }
                    lets = lets.concat(scopedNodes(node, isFreeVariable(['let']), true));
                    directives = scopedNodes(node, function (n) {
                        return examine(n).isDirective;
                    }, true);
                    functions = scopedNodes(node, isHoistableFunction, inStrictBody);
                    vars = vars ? extractVars(vars, 'var') : {
                        duplicates: {},
                        decls: []
                    };
                    lets = lets ? extractVars(lets, 'let') : {
                        duplicates: {},
                        decls: []
                    };
                    Object.keys(vars.duplicates).forEach(function (id) {
                        logger(where(vars.duplicates[id]) + "Duplicate declaration '" + printNode(vars.duplicates[id]) + "'");
                    });
                    Object.keys(lets.duplicates).forEach(function (id) {
                        logger(where(lets.duplicates[id]) + "Duplicate declaration '" + printNode(lets.duplicates[id]) + "'");
                    });
                    functions = functions.map(function (path) {
                        var ref = path[0], symName;
                        // What is the name of this function (could be async, so check the expression if necessary),
                        // and should we remove and hoist, or reference and hoist?
                        if (examine(ref.self).isAsync) {
                            symName = ref.self.id.name;
                            // If we're actually a top-level async FunctionExpression, redeclare as a FunctionDeclaration
                            if (examine(ref.parent).isBlockStatement) {
                                ref.self.type = 'FunctionDeclaration';
                                ref.remove();
                                return ref.self;
                            }
                            // We're an async FunctionExpression
                            return ref.replace(ident(symName));
                        }
                        // We're just a vanilla FunctionDeclaration or FunctionExpression
                        symName = ref.self.id.name;
                        var movedFn = ref.self.type === 'FunctionDeclaration' ? ref.remove() : ref.replace(ident(symName));
                        return movedFn;
                    });
                    directives = directives.map(function (path) {
                        var ref = path[0];
                        return ref.remove();
                    });
                    if (directives.length || vars.decls.length || lets.decls.length || functions.length) {
                        node.body = directives.concat(vars.decls).concat(lets.decls).concat(functions).concat(node.body);
                    }
                }
                inStrictBody = prevScope;
            }
            // Labeled breaks need to be treated as loops that always exit early, if they contain awaits
            if (node.type === 'LabeledStatement' && node.body.type === 'BlockStatement' && containsAwait(node.body)) {
                if (contains(node.body, function (m) {
                    return m.type === 'BreakStatement' && m.label && m.label.name == node.label.name;
                })) {
                    node.body.body.push({
                        type: 'BreakStatement'
                    });
                    node.body = {
                        type: 'DoWhileStatement',
                        test: literal(0),
                        body: node.body
                    };
                }
            }
            descend();
            // It makes life easier if labeled loops have the label to hand, so we simply reference them here with a hidden $label
            // and keep a record of how nested the for loop is (since it's transformed top to bottom and counting during
            // transformation is therefore not possible
            if (node.type === 'ForOfStatement' || node.type === 'ForInStatement' || examine(node).isLoop) {
                var depth = 0;
                for (var n = 0;n < path.length; n++) 
                    if (path[n].self.type === 'ForOfStatement' || path[n].self.type === 'ForInStatement' || examine(path[n].self).isLoop) 
                    depth += 1;
                 else if (examine(path[n].self).isFunction) 
                    break;
                node.$depth = depth;
                if (path[0].parent.type === 'LabeledStatement') {
                    node.$label = path[0].parent.label;
                } else {
                    node.$label = null;
                }
            }
            return true;
        });
        return ast;
    }
21169
def _isnull(expr):
    

    if isinstance(expr, SequenceExpr):
        return IsNull(_input=expr, _data_type=types.boolean)
    elif isinstance(expr, Scalar):
        return IsNull(_input=expr, _value_type=types.boolean)
816801
def set_seq2(self, b):
        
        if b is self.b and hasattr(self, 'isbjunk'):
            return
        self.b = b
        if not isinstance(self.a, list):
            self.a = list(self.a)
        if not isinstance(self.b, list):
            self.b = list(self.b)

        # Types must be hashable to work in the c layer.  This check lines will
        # raise the correct error if they are *not* hashable.
        [hash(x) for x in self.a]
        [hash(x) for x in self.b]

        self.matching_blocks = self.opcodes = None
        self.fullbcount = None
        junk, popular = _cdifflib.chain_b(self)
        assert hasattr(junk, '__contains__')
        assert hasattr(popular, '__contains__')
        self.isbjunk = junk.__contains__
        self.isbpopular = popular.__contains__
1101458
@Deprecated
	@Override
	public String getSequence(Long beginPosition, Long endPosition) {

		if (beginPosition == null || endPosition == null
				|| (beginPosition > endPosition) || beginPosition < 1
				|| endPosition >getLength()) {
			return null;
		}
		
       int length = (int) (endPosition.longValue() - beginPosition.longValue()) + 1;
	   int offset = beginPosition.intValue() - 1;
	   String subSequence=null;
		try{
			subSequence= ByteBufferUtils.string(getSequenceBuffer(), offset, length);
		}
		catch(Exception e)
		{
			e.printStackTrace();
			return subSequence;
		}
        return subSequence;
		/*// note begin:1 end:4 has length 4
		

		byte[] subsequence = new byte[length];

		
		synchronized (sequence) {
			sequence.position(offset);
			sequence.get(subsequence, 0, length);
		}
		
		String string = new String(subsequence);

		return string;*/
	}
627495
def _set_seq(self,sequence,start=0):
    """"""
    if start+len(sequence) > self._slen: 
      sys.stderr.write("Error not long enough to add\n")
      sys.exit()
    z = 0
    for i in xrange(start, start+len(sequence)):
      self._set_nt(sequence[z],i)
      z+=1
1103535
def _transform_constant_sequence(self, seq):
        
        should_transform = is_a(self.types)

        if not any(filter(should_transform, flatten(seq))):
            # Tuple doesn't contain any transformable strings. Ignore.
            yield LOAD_CONST(seq)
            return

        for const in seq:
            if should_transform(const):
                yield from self.transform_stringlike(const)
            elif isinstance(const, (tuple, frozenset)):
                yield from self._transform_constant_sequence(const)
            else:
                yield LOAD_CONST(const)

        if isinstance(seq, tuple):
            yield BUILD_TUPLE(len(seq))
        else:
            assert isinstance(seq, frozenset)
            yield BUILD_TUPLE(len(seq))
            yield LOAD_CONST(frozenset)
            yield ROT_TWO()
            yield CALL_FUNCTION(1)
153337
private void compileAssignment(Sequence sequence, TokenList tokens, TokenList.Token t0) {
        // see if it is assign or a range
        List<Variable> range = parseAssignRange(sequence, tokens, t0);

        TokenList.Token t1 = t0.next;
        if (t1.getType() != Type.SYMBOL || t1.getSymbol() != Symbol.ASSIGN)
            throw new ParseError("Expected assignment operator next");

        // Parse the right side of the equation
        TokenList tokensRight = tokens.extractSubList(t1.next, tokens.last);
        compileTokens(sequence, tokensRight);
        if (tokensRight.getLast().getType() != Type.VARIABLE)
            throw new RuntimeException("BUG the last token must be a variable");

        // copy the results into the output
        Variable variableRight = tokensRight.getFirst().getVariable();
        if (range == null) {
            // no range, so copy results into the entire output matrix
            sequence.output = createVariableInferred(t0, variableRight);
            sequence.addOperation(Operation.copy(variableRight, sequence.output));
        } else {
            // a sub-matrix range is specified.  Copy into that inner part
            if (t0.getType() == Type.WORD) {
                throw new ParseError("Can't do lazy variable initialization with submatrices. " + t0.getWord());
            }
            sequence.addOperation(Operation.copy(variableRight, t0.getVariable(), range));
        }
    }
657577
function postSequence(elems, fin) {
    // Treat the final value of a sequence as its return value
    var toReturn = elems[elems.length - 1];
    return fin(null, toReturn);
}
545968
function(sequence, i)
	{
		if ( i == undefined ) i = 0;
		
		var output = [];
		var len = sequence.length;
		i += 1;

		// [foo, bar, ...]
		while ( i < len )
		{
			switch ( sequence.charAt(i) )
			{
				case '[':
					// nested sequence
					output.push(this.parseSequence(sequence, i));
					i = this.i;
					break;
				case '{':
					// nested mapping
					output.push(this.parseMapping(sequence, i));
					i = this.i;
					break;
				case ']':
					this.i = i;
					return output;
				case ',':
				case ' ':
					break;
				default:
					var isQuoted = this.inArray(sequence.charAt(i), ['"', "'"]);
					var value = this.parseScalar(sequence, [',', ']'], ['"', "'"], i);
					i = this.i;
					
					if ( !isQuoted && (value+'').indexOf(': ') != -1 )
					{
						// embedded mapping?
						try
						{
							value = this.parseMapping('{'+value+'}');
						}
						catch ( e )
						{
							if ( !(e instanceof YamlParseException ) ) throw e;
							// no, it's not
						}
					}

					output.push(value);

					i--;
			}

			i++;
		}

		throw new YamlParseException('Malformed inline YAML string "'+sequence+'"');
	}
1195194
def sorensen(seq1, seq2):
	
	set1, set2 = set(seq1), set(seq2)
	return 1 - (2 * len(set1 & set2) / float(len(set1) + len(set2)))
229314
@JRubyMethod(name = "value=")
    public static IRubyObject value_set(IRubyObject self, IRubyObject val) {
        org.yecht.Node node = (org.yecht.Node)self.dataGetStructChecked();
        Ruby runtime = self.getRuntime();

        val = val.checkArrayType();
        if(!val.isNil()) {
            node.seqEmpty();
            Data.Seq ds = (Data.Seq)node.data;
            for(int i=0; i<((RubyArray)val).getLength(); i++) {
                node.seqAdd(((RubyArray)val).entry(i));
            }
        }

        ((RubyObject)self).fastSetInstanceVariable("@value", val);
        return val;
    }
332030
protected function setSepaSequenceTypeAttr($value = null, $isDirty = true)
    {
		$value = strtoupper($value);
        if ($value !== null && $value !== '' && !in_array($value, $this->_sepaSequenceTypes)) {
            throw new InvalidSequenceTypeException('Invalid sequence type: ' . $value);
        }

        $this->sepaSequenceType = $value;
        $this->setDirtyState($isDirty, 'sepaSequenceType');
    }
38304
private List<String> transformSimpleSequenceAsStringList(SimpleSequence sequence, String paramName)
            throws TemplateModelException {
        List<String> list = new ArrayList<>();
        int size = sequence.size();
        for (int i = 0; i < size; i++) {
            TemplateModel model = sequence.get(i);
            if (!(model instanceof SimpleScalar)) {
                throw new IllegalArgumentException(paramName + "'s item must be string");
            }
            list.add(((SimpleScalar)model).getAsString());
        }
        return list;
    }
371527
def framers(self, value):
        

        # Handle sequence values
        if isinstance(value, collections.Sequence):
            if len(value) != 2:
                raise ValueError('need exactly 2 values to unpack')
            elif (not isinstance(value[0], framers.Framer) or
                  not isinstance(value[1], framers.Framer)):
                raise ValueError("framer must be an instance of "
                                 "tendril.Framer")

            self._send_framer, self._recv_framer = value

        # If we have a single value, assume it's a framer
        else:
            if not isinstance(value, framers.Framer):
                raise ValueError("framer must be an instance of "
                                 "tendril.Framer")

            self._send_framer = value
            self._recv_framer = value