|
|
|
|
@ -99,15 +99,15 @@ We define auxiliary functions to get to the solution |
|
|
|
|
|
|
|
|
|
The solution of part 1 is |
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(-reduce #'+ (--map (* (car it) (cdr it)) |
|
|
|
|
(-zip-pair (-map #'length regions) |
|
|
|
|
(-map (lambda (region) (-reduce #'+ (-map #'count-fence region))) regions)))) ;part 1 |
|
|
|
|
(-reduce #'+ (--map (* (car it) (cdr it)) |
|
|
|
|
(-zip-pair (-map #'length regions) |
|
|
|
|
(-map (lambda (region) (-reduce #'+ (-map #'count-fence region))) regions)))) |
|
|
|
|
#+end_src |
|
|
|
|
The solution of part 2 is |
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(-reduce #'+ (--map (* (car it) (cdr it)) |
|
|
|
|
(-zip-pair (-map #'length regions) |
|
|
|
|
(-map (lambda (region) (-reduce #'+ (-map #'count-vertices region))) regions)))) ;part 2 |
|
|
|
|
(-reduce #'+ (--map (* (car it) (cdr it)) |
|
|
|
|
(-zip-pair (-map #'length regions) |
|
|
|
|
(-map (lambda (region) (-reduce #'+ (-map #'count-vertices region))) regions)))) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
#+RESULTS: |
|
|
|
|
|