Skip to content

Commit

Permalink
Simplify do.coffee
Browse files Browse the repository at this point in the history
This version is directly executable, and illustrates more directly the concept. One can comment out line jashkenas#3 and run again to see the difference.
  • Loading branch information
bfab committed Aug 8, 2014
1 parent ab6f69c commit 3f7c736
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions documentation/coffee/do.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
for filename in list
do (filename) ->
fs.readFile filename, (err, contents) ->
compile filename, contents.toString()
multipliers = [1, 2, 3]
multiples = for j in multipliers
do (j) ->
(x) -> x * j

alert(f(2) for f in multiples)

0 comments on commit 3f7c736

Please sign in to comment.