-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move examples to examples/ directory, add for loop examnple (#64)
- Loading branch information
Showing
9 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// for loop example, functional style | ||
// executes with 1..n passed to the function parameter. | ||
|
||
for=func(n, f) { | ||
l=func(i,f) { // internal lambda with the index param | ||
r = f(i) | ||
if (i>=n) { | ||
return r | ||
} | ||
l(i+1, f) | ||
} | ||
l(1,f) | ||
} | ||
|
||
for(5, func(n) { | ||
log("n is", n) | ||
n // return value at the end | ||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.