【发布时间】:2013-05-09 00:18:59
【问题描述】:
我对 Elisp 有一个(可能)愚蠢的问题。我想要一个函数根据when 条件返回t 或nil。这是代码:
(defun tmr-active-timer-p
"Returns t or nil depending of if there's an active timer"
(progn
(if (not (file-exists-p tmr-file))
nil
; (... more code)
)
)
)
但我有一个错误。我不知道如何让函数返回一个值...我已经读过一个函数返回最后一个表达式结果值,但在这种情况下,我不想做出类似(PHP 混乱警告)之类的事情:
// code
if ($condition) {
return false;
}
// more code...
也许我没有抓住重点,函数式编程不允许这种方法?
【问题讨论】:
-
好吧,问题实际上是在 tmr-active-timer-p 之前缺少括号。
-
您需要接受答案。
标签: function emacs return elisp