From 9d466ff5aa8fe6a902b46c8d99924c919e7b30e0 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 5 Aug 2019 07:12:41 +0900 Subject: [PATCH] Created file to put some useful functions. --- PRELUDE.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 PRELUDE.md diff --git a/PRELUDE.md b/PRELUDE.md new file mode 100644 index 0000000..0166af6 --- /dev/null +++ b/PRELUDE.md @@ -0,0 +1,33 @@ +# Prelude + +## Colors + +### Compare two Colors + +Use: `(if (color-eq (255 200 0) (200 255 0)) "yes" "no")`. + +``` +(defn color-eq + (a b) + (and + (eq a:0 b:0) + (eq a:1 b:1) + (eq a:2 b:2))) +``` + +## Pixels + +### Erase all pixels of a specific color + +Use: `(pixels erase-color (255 0 0))`. + +``` +(defn erase-color + (a b) + (a:0 a:1 a:2 + (if + (and + (eq a:0 b:0) + (eq a:1 b:1) + (eq a:2 b:2)) 0 255))) +``` \ No newline at end of file