Skip to content

Instantly share code, notes, and snippets.

@rockymeza
rockymeza / gist:1244432
Created September 27, 2011 05:53 — forked from gavinwahl/gist:1244417
relation algebra
function Relation(schema, data)
{
this.schema = schema;
this.data = data;
// only supports equals for now
this.s = function(attribute, value) {
var index = this.schema.indexOf(attribute);
var new_data = this.data.filter(function(datum) {
return datum[index] == value;