我是ELisp的新手,我无法设置变量值以备后用。我读了the documentation on accessing variable values,并尝试了this thread中的答案,但是我仍然得到public class Id
{
public int value { get; set; }
public string url { get; set; }
public string content { get; set; }
}
public class RootObject
{
public string images { get; set; }
public List<Id> id { get; set; }
public List<string> answers { get; set; }
public string type { get; set; }
public string row { get; set; }
}
。
这是我的Wrong type argument: char-or-string-p
Emacs缓冲区的输出,该缓冲区运行代码并在出现任何副作用后将其插入:
*scratch*
我可以遍历由该值构成的列表作为文字:
(defvar my-var "var" "Some documentation")
my-var
my-var
"var"
(symbol-value 'my-var)
"var"
但是这些尝试将值作为变量进行迭代的每一次尝试都失败,并出现相同的错误(dolist (v '("var"))
(insert v))
varnil
:
Wrong type argument: char-or-string-p
如何遍历由变量值组成的列表?
答案 0 :(得分:4)
您需要评估您的变量:
(dolist (v (list my-var))
(insert v))
或自己获取值:
(dolist (v (list 'my-var))
(insert (symbol-value v)))
如果要混合使用变量和文字,请使用第一种方法:
(defvar my-var "var" "Some documentation")
(dolist (d (list my-var
"other-var"))
(insert d))