olleicua / hcl

Hot Cocoa Lisp
GNU General Public License v3.0
34 stars 4 forks source link

add a key+value form to `for` loop #11

Closed olleicua closed 10 years ago

olleicua commented 11 years ago

We want:

(var numbers [ 1 2 3 4 5 ] )
(for ((key value) numbers)
     (console.log key value))

->

var numbers = [1, 2, 3, 4, 5];
(function() {for (key = 0; key < numbers.length; key++) { var value = numbers[key]; console.log(key, value); }}).call(this);