In the book Let Over Lambda : Chapter 4, the cl-ppcre section uses a read macro with send characters # ~ to get matching and regular expression syntax similar to Perl. The function used to implement read-macro is | # ~ -reader |.
This function is implemented using two macros defined earlier:
- match-mode-ppcre lambda form
- sub-mode-ppcre lambda form
I was interested, in addition to the educational goal, what is the need to use macros for the above two tasks? I implemented an option using simple functions:
(defun match-mode-alt (args)
`(lambda (x) (cl-ppcre:scan ,(car args) x)))
(defun subst-mode-alt (args)
`(lambda (x) (cl-ppcre:regex-replace-all ,(car args)
x
,(cadr args))))
, , , . , , , , , .
? , ( read-macro), .