[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Converting &rest body to string?
From: |
Jean Louis |
Subject: |
Converting &rest body to string? |
Date: |
Mon, 03 May 2021 00:38:30 +0300 |
Would there be any way to convert the ,@body part to string:
(defmacro clisp-macro (&rest body)
(declare (indent 1) (debug t))
`(clisp (prin1-to-string (quote ,@body)) t))
That works, it invokes external Lisp with single form like:
(clisp-macro (princ (format nil "~R" 123))) ⇒ "one hundred and twenty-three"
with the underlying function:
(defun clisp (data &optional trim)
(if (rcd-which "clisp")
(let* ((value (if data
(rcd-command-output-from-input "clisp" data "-q"
"-norc" "-")
""))
(value (if trim (string-trim value) value)))
value)
(rcd-warning-message "RCD ERROR: `clisp' not found in $PATH")))
As ,@body could be sometimes multiple arguments, like list, I would
like to find way to accept ,@body and get string out of it, that I can make
`perl' macro, so that following starts working:
(perl 1+1) or (perl 1 + 1) where 1+1 would be converted to "1+1" or 1
+ 1 would become "1 + 1", basically all arguments after `perl' to
become single string?
Somehow it seems possible.
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Converting &rest body to string?,
Jean Louis <=