开发者

Change nil's to zeroes in elisp

开发者_如何学运维I'd like to ask - what is the function doing nil conversion from nil's to zeroes in elisp?

I'm a newbie and I think I am inventing the wheel with my code:

(defun chgnull (x)
  (if (null x) 0 1))
(mapcar 'chgnull '(1 2 nil))

Search through Emacs sources by keyword "to zero" and such haven't shown anything relevant.


The expression (or x 0) will evaluate to 0 if x is nil, and x otherwise.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜