add prelude.lisp
This commit is contained in:
parent
fade8cb396
commit
0f2acc0d0e
11
desktop/sources/lisp/prelude.lisp
Normal file
11
desktop/sources/lisp/prelude.lisp
Normal file
@ -0,0 +1,11 @@
|
||||
(echo "Loading prelude.lisp")
|
||||
|
||||
(defn translate
|
||||
(r p)
|
||||
(clone
|
||||
r
|
||||
(rect
|
||||
(of p :x)
|
||||
(of p :y)
|
||||
(of r :w)
|
||||
(of r :h))))
|
@ -167,10 +167,12 @@ function Lisp (input, lib) {
|
||||
}
|
||||
|
||||
this.parse = function (input) {
|
||||
return parenthesize(tokenize(`(${input})`))
|
||||
return parenthesize(tokenize(input))
|
||||
}
|
||||
|
||||
this.toPixels = async function () {
|
||||
return interpret(this.parse(input))
|
||||
return interpret(this.parse(`(
|
||||
(include "./sources/lisp/prelude.lisp")
|
||||
${input})`))
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,11 @@
|
||||
(defn glitch
|
||||
(rec)
|
||||
(if (gt rec 1)
|
||||
((clone
|
||||
(rect (random 400) (random 400) 2 2)
|
||||
(rect (random 400) (random 400)
|
||||
(random 10) (random 30)))
|
||||
(glitch (sub rec 1))))
|
||||
)
|
||||
(
|
||||
(translate
|
||||
(rect (random 400) (random 400) (random 10) (random 10))
|
||||
(pos (random 400) (random 400)))
|
||||
(glitch (sub rec 1)))))
|
||||
|
||||
(import
|
||||
"../static/crystal.jpg"
|
||||
|
Loading…
x
Reference in New Issue
Block a user