Improved shape example

This commit is contained in:
Devine Lu Linvega
2019-08-01 15:43:24 +09:00
parent 12bacf0551
commit 580a4721b2
10 changed files with 31 additions and 35 deletions

26
examples/_OLD/arrays.lisp Normal file
View File

@@ -0,0 +1,26 @@
(echo (map '(add %1 1) (1 2 3)))
(echo (first (1 2 3)))
(echo (rest (1 2 3)))
(echo
(filter
'(eq 0 (mod %1 2))
(1 2 3 4 5))
)
(clear)
(map
'(stroke (rect (mul a 30) 20 50 50)
1 "red")
(range 0 20 5))
(map
'(stroke
(rect
(mul %1 10)
(add 250 (mul (sin %1) 250))
(mul 4 %1)
(add 20 (mul (cos %1) 50))) 1 "red")
(range 0 200 5))

View File

@@ -0,0 +1,5 @@
(clear)
(def a (import
"../static/crystal.jpg"
(rect 0 0 400 400)))
(echo a)

View File

@@ -0,0 +1,3 @@
; include
(include "../examples/recursive.lisp")
(echo line-color)

View File

@@ -0,0 +1,17 @@
; objects
(test "symbols" :a "a")
(def ob {:a "fantastic" :b 2})
((of (js) :console :log) ob)
(echo (of ob :a))
(echo (keys ob))
(echo (values ob))
(set ob :a 4)
(echo (of ob :a))
(echo (map '(add %1 2) (4 5 6))

View File

@@ -0,0 +1,14 @@
; filesystem
; get files
(def files
(dir
(dirpath)))
; pick a random file
(def random-index
(floor
(random
(len files))))
; print random file name
(echo
(get files random-index))

View File

@@ -0,0 +1,5 @@
; resize
(clear)
(open "../../PREVIEW.jpg")
(resize 0.5 0.5)