Last active
January 5, 2023 12:06
-
-
Save mattdesl/a572a534fb1796955a3a2e6ca5d3ef8a to your computer and use it in GitHub Desktop.
example of Ryu syntax (all built-in APIs are unstable)
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
; a loop utility | |
(fn loop (n iter) (do | |
(var i 0) | |
(while (< i n) (do | |
(iter i) | |
(set i (+ 1 i)) | |
)) | |
)) | |
(var BG 0xff) | |
(var FG 0x00) | |
(random/seed 5) | |
(canvas/fill BG) | |
(var count 20) | |
(loop count (fn (i) (do | |
(var y (random 0 width)) | |
(var x (random 0 height)) | |
(var len (random 0 (* 0.25 width))) | |
(var x2 (+ x len)) | |
(var y2 (+ y len)) | |
(canvas/line x y x2 y2 FG) | |
))) | |
; finally emit the canvas | |
(canvas/draw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment