Skip to content

Instantly share code, notes, and snippets.

@slaskis
Created October 10, 2009 15:30
Show Gist options
  • Save slaskis/206923 to your computer and use it in GitHub Desktop.
Save slaskis/206923 to your computer and use it in GitHub Desktop.
// Proposed syntax:
var a,b,c = function() { return [1,2,3]; };
// Equivalent to:
var r = function() { return [1,2,3]; };
var a = r[0];
var b = r[1];
var c = r[2];
// Could generate some clean syntax combined with using.
using Lambda;
var a,b,c = [1,2,3,4,5].map( function(v) { return v+5; } );
// a = 6, b = 7, c = 8;
// Alt. with access to original array:
using Lambda;
var m = [1,2,3,4,5].map( function(v) { return v+5; } );
var a,b,c = m;
// Instead of:
using Lambda;
var m = [1,2,3].map( function(v) { return v+5; } );
var a = m[0];
var b = m[1];
var c = m[2];
// Here the rest is available too in the "m" variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment