src/stdlib/sequence.c
/*==================================================
 * delseq -- Remove and return element from sequence
 *================================================*/
- Remove and return element from sequence
- Remove and return element from sequence
ELEMENT
delseq (SEQUENCE seq,   
        ELEMENT val)    
{
	INT i, n, loc;
	ELEMENT el, *d;
	seqerr = NONE;
	if (!fndel(seq, val, &loc)) return 0;
	if (loc < 0 || loc >= (n = Size(seq)))  {
		seqerr = RANGE;
		return 0;
	}
	d = Data(seq);
	el = d[loc];
	for (i = loc; i < n-1; i++)
		d[i] = d[i+1];
	--Size(seq);
	return el;
}
ELEMENT delseq ( SEQUENCE seq , ELEMENT val ) { INT i , n , loc ; ELEMENT el , * d ; seqerr = NONE ; if ( ! fndel ( seq , val , & loc ) ) return 0 ; if ( loc < 0 || loc >= ( n = Size ( seq ) ) ) { seqerr = RANGE ; return 0 ; } d = Data ( seq ) ; el = d [ loc ] ; for ( i = loc ; i < n - 1 ; i ++ ) d [ i ] = d [ i + 1 ] ; -- Size ( seq ) ; return el ; }
delseq -- Remove and return element from sequence
delseq -- Remove and return element from sequence
/* sequence */ /* el value */