You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

693 B

Solution to p5

First load the data as a list of cons cells (start . end)

  (with-temp-buffer
    (insert-file-contents "input-test")
    (advent/replace-multiple-regex-buffer
     '(
       ("^\\([0-9]*\\)-\\([0-9]*\\)$" . "(\\1 . \\2)")
       ("^$" . ") ids '(")))
    (goto-char (point-min))
    (insert "(setq ranges '(")
    (goto-char (point-max))
    (insert "))")
    (eval-buffer))
  (length 
   (-filter (lambda (id)
  	    (--any (and (>= id (car it))
  			(<= id (cdr it)))
  (setq sorted-ranges (--sort (< (car it) (car other)) ranges))
744