(Emacs)~made sys-name-cond nicer to read

I used an iterative style for it before, but now its more functional
as there is a 1-1 mapping between pairs given and cond forms.
This commit is contained in:
2023-03-26 20:06:11 +01:00
parent 166d158143
commit ceeebf1e0c

View File

@@ -137,17 +137,14 @@ solution than this, this seems simple enough.
Each pair in PAIRS is typed as: (string . (forms...)) where the Each pair in PAIRS is typed as: (string . (forms...)) where the
string represents the system name to test, and forms being the string represents the system name to test, and forms being the
consequence if true." consequence if true."
(let ((current-lisp)) `(cond
(while pairs ,@(mapcar #'(lambda (pair)
(let ((pair (car pairs))) ;; (str . forms..) -> ((string= str (system-name))
;; forms...)
(let ((name (car pair)) (let ((name (car pair))
(body (cdr pair))) (body (cdr pair)))
(add-to-list `((string= ,name (system-name)) ,@body)))
'current-lisp pairs)))
`((string= ,name (system-name)) ,@body))
(setq pairs (cdr pairs)))))
`(cond
,@current-lisp)))
#+end_src #+end_src
In [[file:early-init.el][early-init.el]] I set the number of native-workers to 4, which isn't In [[file:early-init.el][early-init.el]] I set the number of native-workers to 4, which isn't