Created
January 25, 2018 16:03
-
-
Save joebo/db375fb38f3e52f8feff5c7237b00379 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(de readIn NIL | |
(in "/mnt/c/temp/day16.txt" | |
(make | |
(until (eof) | |
(let Parts | |
(filter | |
'prog | |
(mapcar 'pack (split (line) "," ":" " ")) ) | |
(link | |
(make | |
(for (L Parts L) | |
(link | |
(make | |
(link (pop 'L)) | |
(link (pop 'L)) ) ) ) ) ) ) ) ) ) ) | |
(setq Rules (quote | |
("children" "3") | |
("cats" "7") | |
("samoyeds" "2") | |
("pomeranians" "3") | |
("akitas" "0") | |
("vizslas" "0") | |
("goldfish" "5") | |
("trees" "3") | |
("cars" "2") | |
("perfumes" "1")) ) | |
(de testMatch (Row) | |
# use cdr to skip Sue part | |
(apply 'and (mapcar '((X) (member X Rules)) (cdr Row))) ) | |
(setq Input (readIn)) | |
(msg (filter 'testMatch Input)) | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment