Refactor problem spec code

This commit is contained in:
Kiana Sheibani 2024-03-22 00:54:00 -04:00
parent ef7caec424
commit 52a62591b6
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -3546,15 +3546,14 @@ This section is for code with little or no associated documentation. This could
(problems
(mapcan
(lambda (spec)
(let* ((match (car (or (--keep
(when-let ((x (cdr-safe
(s-match (car it) spec))))
(cons x (cdr it)))
(let* ((match
(or (--some (-some-> (s-match (car it) spec)
cdr (cons (cdr it)))
alist)
(user-error "Invalid problem spec")))))
(user-error "Invalid problem spec \"%s\"" spec))))
(apply (cdr match) (mapcar #'string-to-number (car match)))))
specs)))
(insert "\n")
(move-to-left-margin)
(dolist (num problems)
(insert (format "- [ ] %d\n" num)))))
#+end_src