Hi,

On Tue, 19 Sep 2023 at 04:43, Rodrigo Morales <moralesrodrigo1...@gmail.com> 
wrote:

> #+BEGIN_SRC elisp
> (defmacro my-define-variables (string)
>   `(progn
>     (defvar ,(intern (concat string "-1")) "one")
>     (defvar ,(intern (concat string "-2")) "two")))
>
> (my-define-variables "hello")
>
> (list hello-1 hello-2)
> #+END_SRC

Well, Guile implements the good way and the traditional way. :-)

https://www.gnu.org/software/guile/manual/html_node/Macros.html

Let use « Lisp-style Macro Definitions » which looks similar to Emacs
Lisp.

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (defmacro my-define-variables (str)
  `(begin
     (define ,(string->symbol (string-append str "-1")) "one")
     (define ,(string->symbol (string-append str "-2")) "two")))
scheme@(guix-user)> (my-define-variables "hello")
scheme@(guix-user)> (list hello-1 hello-2)
$2 = ("one" "two")
--8<---------------cut here---------------end--------------->8---

Well, I do not know if it is the correct way.

Hope that help,
simon

Reply via email to