Skip to content

Instantly share code, notes, and snippets.

@joebo
Created January 25, 2018 16:03
Show Gist options
  • Save joebo/db375fb38f3e52f8feff5c7237b00379 to your computer and use it in GitHub Desktop.
Save joebo/db375fb38f3e52f8feff5c7237b00379 to your computer and use it in GitHub Desktop.
(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