Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@StanAngeloff
Created November 20, 2010 16:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StanAngeloff/707950 to your computer and use it in GitHub Desktop.
Save StanAngeloff/707950 to your computer and use it in GitHub Desktop.
Nope, this is not some fancy non-ANSI SQL; this is CoffeeScript
SELECT = (map, results) -> map.call each for each in results
FROM = (list, reduce) -> each for each in list when reduce each
WHERE = (reduce) -> (each) -> reduce.call each
SELECT -> { @name },
FROM Users,
WHERE -> @age > 18 and @age < 64
SELECT(function() {
return {
name: this.name
};
}, FROM(Users, WHERE(function() {
return this.age > 18 && this.age < 64;
})));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment