lib/px.js
function(s) {
                //TODO: validate array length
		//TODO: return unwanted subset as new Px object

                var counts = this.valCounts(),
                multipliers = [];

                _.each(s, function(d, i) {
                    if (d[0] === '*') {
                        s[i] = _.range(0, counts[i] - 1);
                    }
                });

                for (var i = 0, l = counts.length; i < l - 1; i++) {
                    multipliers[i] = _.reduce(counts.slice(i+1), function(a, b) { return a * b; });
                }
                multipliers.push(1);

                for (var j = 0, k = s.length; j < k; j++) {
                    
                    // drop the values
                    this.metadata.VALUES[this.variables()[j]] = 
                        _.filter(this.metadata.VALUES[this.variables()[j]], function(e, m) {
                            return _.indexOf(s[j], m) !== -1;
                        });
                }

                var keepIdxs = [];
                var pattern = function pattern(c,m,w,p) {
                    if (c.length > 1) {
                        p = typeof p !== 'undefined' ? p : 1;
                        var count = c.pop(),
                            multiple = m.pop(),
                            want = w.pop();

                        var patt = _.flatten(_.map(_.range(0, count), function(d) { 
                            return _.include(want, d) ? p : _arrayOfZeroes(multiple);
                        }));

                        pattern(c, m, w, patt);
                    }
                    keepIdxs.push(_.flatten(p));
                };
                pattern(counts,multipliers,s);
                keepIdxs = keepIdxs[0];

                var indices = [];
                _.each(s[0], function(d) {
                    var start = d * multipliers[0];
                    var end = start + multipliers[0];
                    indices.push(_.filter(_.range(start, end), function(d, i) {return keepIdxs[i] === 1;}));
                });
                indices = _.flatten(indices);
                this.data = _.filter(this.data, function(d, i) {return _.indexOf(indices, i) !== -1;});
            }
function(s) {
                //TODO: validate array length
		//TODO: return unwanted subset as new Px object

                var counts = this.valCounts(),
                multipliers = [];

                _.each(s, function(d, i) {
                    if (d[0] === '*') {
                        s[i] = _.range(0, counts[i] - 1);
                    }
                });

                for (var i = 0, l = counts.length; i < l - 1; i++) {
                    multipliers[i] = _.reduce(counts.slice(i+1), function(a, b) { return a * b; });
                }
                multipliers.push(1);

                for (var j = 0, k = s.length; j < k; j++) {
                    
                    // drop the values
                    this.metadata.VALUES[this.variables()[j]] = 
                        _.filter(this.metadata.VALUES[this.variables()[j]], function(e, m) {
                            return _.indexOf(s[j], m) !== -1;
                        });
                }

                var keepIdxs = [];
                var pattern = function pattern(c,m,w,p) {
                    if (c.length > 1) {
                        p = typeof p !== 'undefined' ? p : 1;
                        var count = c.pop(),
                            multiple = m.pop(),
                            want = w.pop();

                        var patt = _.flatten(_.map(_.range(0, count), function(d) { 
                            return _.include(want, d) ? p : _arrayOfZeroes(multiple);
                        }));

                        pattern(c, m, w, patt);
                    }
                    keepIdxs.push(_.flatten(p));
                };
                pattern(counts,multipliers,s);
                keepIdxs = keepIdxs[0];

                var indices = [];
                _.each(s[0], function(d) {
                    var start = d * multipliers[0];
                    var end = start + multipliers[0];
                    indices.push(_.filter(_.range(start, end), function(d, i) {return keepIdxs[i] === 1;}));
                });
                indices = _.flatten(indices);
                this.data = _.filter(this.data, function(d, i) {return _.indexOf(indices, i) !== -1;});
            }
function ( s ) { //TODO: validate array length //TODO: return unwanted subset as new Px object var counts = this . valCounts ( ) , multipliers = [ ] ; _ . each ( s , function ( d , i ) { if ( d [ 0 ] === '*' ) { s [ i ] = _ . range ( 0 , counts [ i ] - 1 ) ; } } ) ; for ( var i = 0 , l = counts . length ; i < l - 1 ; i ++ ) { multipliers [ i ] = _ . reduce ( counts . slice ( i + 1 ) , function ( a , b ) { return a * b ; } ) ; } multipliers . push ( 1 ) ; for ( var j = 0 , k = s . length ; j < k ; j ++ ) { // drop the values this . metadata . VALUES [ this . variables ( ) [ j ] ] = _ . filter ( this . metadata . VALUES [ this . variables ( ) [ j ] ] , function ( e , m ) { return _ . indexOf ( s [ j ] , m ) !== - 1 ; } ) ; } var keepIdxs = [ ] ; var pattern = function pattern ( c , m , w , p ) { if ( c . length > 1 ) { p = typeof p !== 'undefined' ? p : 1 ; var count = c . pop ( ) , multiple = m . pop ( ) , want = w . pop ( ) ; var patt = _ . flatten ( _ . map ( _ . range ( 0 , count ) , function ( d ) { return _ . include ( want , d ) ? p : _arrayOfZeroes ( multiple ) ; } ) ) ; pattern ( c , m , w , patt ) ; } keepIdxs . push ( _ . flatten ( p ) ) ; } ; pattern ( counts , multipliers , s ) ; keepIdxs = keepIdxs [ 0 ] ; var indices = [ ] ; _ . each ( s [ 0 ] , function ( d ) { var start = d * multipliers [ 0 ] ; var end = start + multipliers [ 0 ] ; indices . push ( _ . filter ( _ . range ( start , end ) , function ( d , i ) { return keepIdxs [ i ] === 1 ; } ) ) ; } ) ; indices = _ . flatten ( indices ) ; this . data = _ . filter ( this . data , function ( d , i ) { return _ . indexOf ( indices , i ) !== - 1 ; } ) ; }
remove values and associated data from this object
remove values and associated data from this object