-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added repeat function and refactored relevant examples
- Loading branch information
1 parent
b6f9054
commit 648dc6c
Showing
5 changed files
with
36 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,3 +97,8 @@ | |
(name complex) | ||
(modules complex) | ||
(libraries joy)) | ||
|
||
(executable | ||
(name repeat) | ||
(modules repeat) | ||
(libraries joy)) |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
open Joy.Shape | ||
|
||
(* | ||
demonstration of the repeat function | ||
takes n, an operation, and an initial shape, and applies the operation | ||
iteratively to the initial shape n times | ||
adapted from the original Joy python library's examples | ||
*) | ||
|
||
let () = | ||
init (); | ||
let circle = circle ~x: (-100) ~y: 0 50 in | ||
let shapes = repeat 10 (translate 10 0) circle in | ||
render_shape shapes; | ||
close (); |
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