diff options
| author | 2025-10-23 08:25:36 +0300 | |
|---|---|---|
| committer | 2025-10-23 08:25:36 +0300 | |
| commit | eb15884cf9eeeacde93e174db180181498fb2a19 (patch) | |
| tree | f1f82bea3a2a219d6340fc22416bfad03b3cc652 | |
| parent | Fix lint issues (diff) | |
| download | ukkoclot-eb15884cf9eeeacde93e174db180181498fb2a19.tar.gz ukkoclot-eb15884cf9eeeacde93e174db180181498fb2a19.tar.xz ukkoclot-eb15884cf9eeeacde93e174db180181498fb2a19.zip | |
Use alexandria's make-keyword & symbolicate
| -rw-r--r-- | src/config.lisp | 5 | ||||
| -rw-r--r-- | src/tg/method-macros.lisp | 4 | ||||
| -rw-r--r-- | src/tg/type-macros.lisp | 8 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/config.lisp b/src/config.lisp index 1a139c1..85c9662 100644 --- a/src/config.lisp +++ b/src/config.lisp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | (:documentation "Stuff for loading the configuration of the bot") | 4 | (:documentation "Stuff for loading the configuration of the bot") |
| 5 | (:nicknames :conf) | 5 | (:nicknames :conf) |
| 6 | (:use :c2cl :iterate :ukkoclot/src/rw-lock) | 6 | (:use :c2cl :iterate :ukkoclot/src/rw-lock) |
| 7 | (:import-from :alexandria :make-keyword) | ||
| 7 | (:export | 8 | (:export |
| 8 | #:*config* | 9 | #:*config* |
| 9 | #:config | 10 | #:config |
| @@ -77,8 +78,8 @@ | |||
| 77 | (for slot in (class-direct-slots (class-of config))) | 78 | (for slot in (class-direct-slots (class-of config))) |
| 78 | (let ((name (slot-definition-name slot))) | 79 | (let ((name (slot-definition-name slot))) |
| 79 | (unless (eql name 'lock) | 80 | (unless (eql name 'lock) |
| 80 | (let ((kw-name (intern (symbol-name name) :keyword))) | 81 | (appending (list (make-keyword name) |
| 81 | (appending (list kw-name (slot-value config name))))))))) | 82 | (slot-value config name)))))))) |
| 82 | 83 | ||
| 83 | (defun print-default (filename) | 84 | (defun print-default (filename) |
| 84 | "Prints the default config to the given `filename'." | 85 | "Prints the default config to the given `filename'." |
diff --git a/src/tg/method-macros.lisp b/src/tg/method-macros.lisp index 56445e3..0d33ffb 100644 --- a/src/tg/method-macros.lisp +++ b/src/tg/method-macros.lisp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | (defpackage :ukkoclot/src/tg/method-macros | 3 | (defpackage :ukkoclot/src/tg/method-macros |
| 4 | (:documentation "Macros for easy defining TG methods.") | 4 | (:documentation "Macros for easy defining TG methods.") |
| 5 | (:use :c2cl :iterate) | 5 | (:use :c2cl :iterate) |
| 6 | (:import-from :alexandria :with-gensyms) | 6 | (:import-from :alexandria :make-keyword :with-gensyms) |
| 7 | (:import-from :com.dieggsy.f-string :enable-f-strings) | 7 | (:import-from :com.dieggsy.f-string :enable-f-strings) |
| 8 | (:import-from :serapeum :take) | 8 | (:import-from :serapeum :take) |
| 9 | (:import-from :state) | 9 | (:import-from :state) |
| @@ -46,7 +46,7 @@ | |||
| 46 | `(setf ,args (acons ',(param-name param) ,(param-name param) ,args))) | 46 | `(setf ,args (acons ',(param-name param) ,(param-name param) ,args))) |
| 47 | 47 | ||
| 48 | (defun emit-arg-type (param) | 48 | (defun emit-arg-type (param) |
| 49 | `(,(intern (symbol-name (param-name param)) :keyword) | 49 | `(,(make-keyword (param-name param)) |
| 50 | ,(param-type param))) | 50 | ,(param-type param))) |
| 51 | 51 | ||
| 52 | (defun emit-defun-arg (param) | 52 | (defun emit-defun-arg (param) |
diff --git a/src/tg/type-macros.lisp b/src/tg/type-macros.lisp index 914261d..ea35f48 100644 --- a/src/tg/type-macros.lisp +++ b/src/tg/type-macros.lisp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | (defpackage :ukkoclot/src/tg/type-macros | 3 | (defpackage :ukkoclot/src/tg/type-macros |
| 4 | (:documentation "Macros for easy defining TG types.") | 4 | (:documentation "Macros for easy defining TG types.") |
| 5 | (:use :c2cl :iterate) | 5 | (:use :c2cl :iterate) |
| 6 | (:import-from :alexandria :with-gensyms) | 6 | (:import-from :alexandria :make-keyword :symbolicate :with-gensyms) |
| 7 | (:import-from :com.dieggsy.f-string :enable-f-strings) | 7 | (:import-from :com.dieggsy.f-string :enable-f-strings) |
| 8 | (:import-from :str) | 8 | (:import-from :str) |
| 9 | (:import-from :ukkoclot/src/serializing :parse-value) | 9 | (:import-from :ukkoclot/src/serializing :parse-value) |
| @@ -34,16 +34,16 @@ | |||
| 34 | :skip-if-default skip-if-default))) | 34 | :skip-if-default skip-if-default))) |
| 35 | 35 | ||
| 36 | (defun type-constructor (name) | 36 | (defun type-constructor (name) |
| 37 | (intern (concatenate 'string "MAKE-" (symbol-name name)))) | 37 | (symbolicate "MAKE-" name)) |
| 38 | 38 | ||
| 39 | (defun field-accessor (name field) | 39 | (defun field-accessor (name field) |
| 40 | (intern (concatenate 'string (symbol-name name) "-" (symbol-name (field-name field))))) | 40 | (symbolicate name "-" (field-name field))) |
| 41 | 41 | ||
| 42 | (defun field-hash-key (field) | 42 | (defun field-hash-key (field) |
| 43 | (str:snake-case (field-name field))) | 43 | (str:snake-case (field-name field))) |
| 44 | 44 | ||
| 45 | (defun field-keyword (field) | 45 | (defun field-keyword (field) |
| 46 | (intern (symbol-name (field-name field)) :keyword)) | 46 | (make-keyword (field-name field))) |
| 47 | 47 | ||
| 48 | (defun parse-field-specs (field-specs) | 48 | (defun parse-field-specs (field-specs) |
| 49 | (iter (for field-spec in field-specs) | 49 | (iter (for field-spec in field-specs) |