help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Question] Define a macro that defines two variables


From: Rodrigo Morales
Subject: [Question] Define a macro that defines two variables
Date: Tue, 19 Sep 2023 04:43:43 +0000

I want to define a macro such that given a string it defines two
variables whose name contain that string

In Emacs, I can do that as it follows

#+HEADER: :results value
#+HEADER: :results verbatim
#+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

#+RESULTS:
#+begin_example
("one" "two")
#+end_example

How to do this in Guile? I want to use this macro in my system
configuration.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]