-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
194daf3
commit 1577c56
Showing
40 changed files
with
192 additions
and
144 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
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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
func compose f1 f2: [ apply f1 apply f2 ] | ||
fn compose f1 f2 [ [ apply f1 apply f2 ] ] | ||
|
||
func make-sum-printer: compose [println] [+] | ||
fn make-sum-printer [ compose [println] [+] ] | ||
|
||
func make-adder x: [→ y: + x y] | ||
fn make-adder x [ [→ y: + x y] ] | ||
|
||
func main: | ||
fn main [ | ||
apply (make-sum-printer 6 5) # Should print 11 | ||
make-adder 5 → 5adder ( | ||
println apply 5adder 3 # Should print 8 | ||
println apply 5adder 11 # Should print 16 | ||
println apply 5adder 76 # Should print 81 | ||
) | ||
] |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
func main: | ||
fn main [ | ||
print "The sum of 3, 4, and 5 is " | ||
println sumof3 3 4 5 | ||
print "The sum of 32, 54, and 43 is " | ||
println sumof3 32 54 43 | ||
] | ||
|
||
func sumof3: + + | ||
fn sumof3 [ + + ] |
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 |
---|---|---|
@@ -1 +1 @@ | ||
func main: println "Hello world!" | ||
fn main [ say "Hello world!" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
func main: | ||
fn main [ | ||
let | ||
func say-message : | ||
fn say-message [ | ||
print "The " | ||
print # prints message | ||
print " of " | ||
print dup | ||
print " is " | ||
] | ||
in ( | ||
(say-message "double" | println double) 4 | ||
(say-message "square" | println square) 4 | ||
) | ||
] | ||
|
||
func double: * 2 | ||
func square: * dup | ||
fn double [ * 2 ] | ||
fn square [ * dup ] | ||
|
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
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
Oops, something went wrong.