我试图对集合执行破坏性操作,并注意到 delete-if 在 SBCL 和 GNU CLISP 中给了我令人惊讶的结果。
将 setf 与 remove-if 组合按预期工作,但我不明白为什么 delete-if 不修改列表。
这是我的代码
(format t "trying weird delete-if problem~%")
(defun data ()
(loop for x from 1 to 9 by 2 collect (cons x (1+ x))))
(defparameter *c1* (data))
(defparameter *c2* (data))
(format t "*c1* is now ~A~%" *c1*)
(format t "*c2* is now ~A~%" *c2*)
(delete-if
(lambda (x)
(progn
(format t "trying to compare ~A ~A~%" x (equal x (cons 1 2)))
(equal x (cons 1 …Run Code Online (Sandbox Code Playgroud) SASS 在生产服务器上插入意外的 CSS 并弄乱了我的a:hover
这是我的 application.css 的片段:
pre {
background-color: #eee;
padding: 10px;
font-size: 11px; }
a {
color: #000000;
}
a:visited {
color: #666666;
}
a:hover {
border-bottom: none;
}
div {
&.field, &.actions {
margin-bottom: 10px; } }
Run Code Online (Sandbox Code Playgroud)
但是在生产服务器上,Firefox 报告以下 css:
pre {
background-color: #EEEEEE;
font-size: 11px;
padding: 10px;
}
a {
color: #000000;
}
a:visited {
color: #666666;
}
a:hover {
border-bottom: 1px solid #777777;
}
div.field, div.actions {
margin-bottom: 10px;
}
Run Code Online (Sandbox Code Playgroud)
在我的开发机器上,Firefox 显示以下 CSS:
a:hover …Run Code Online (Sandbox Code Playgroud) 如何将整数列表[1,2,3]转换为字符串"123"
很抱歉要问明显,但我似乎无法在其他地方找到答案.
为什么从字符串中读取会产生无意义的结果?
CL-USER> (read-from-string "(+ 4 5 6)")
(+ 4 5 6)
9
CL-USER> (+ 4 5 6)
15
CL-USER> (eval (read-from-string "(+ 4 5 6)"))
15
CL-USER>
Run Code Online (Sandbox Code Playgroud) 我需要列表来进一步操作字符串.我不想只打印字符串列表!
https://gist.github.com/bigos/0067a62e15dbed264ce6ef92e0eca58c
如果有人提供了一个示例,其中代码遍历文件名列表并打印每个文件名的前半部分,我会考虑回答这个问题.
这个问题 如何从Haskell的IO动作中获得正常值得到 Riccardo T.的答案.
有很好的伪代码示例.