programming-nu / nu

Nu is an interpreted Lisp that builds on the Objective-C runtime and Foundation framework.
http://programming-nu.github.io
Apache License 2.0
2.15k stars 236 forks source link

about "or" operator #59

Closed scutdavy closed 11 years ago

scutdavy commented 11 years ago
➜  ~  nush
Nu Shell.
% (or NO NO NO)
()

Is this a bug or a feature?

timburks commented 11 years ago

That's what I intended. The or operator returns its first non-false argument, or nil if all arguments are false. To simplify integration with Objective-C, NO (and any representation of zero) is false. nil and () are also false.

% (or nil () 0 0.0 (- 2 2) 123) 123

On Sat, Apr 27, 2013 at 9:44 AM, 邢大为 notifications@github.com wrote:

➜ ~ nush Nu Shell. % (or NO NO NO) ()

Is this a bug or a feature?

— Reply to this email directly or view it on GitHubhttps://github.com/timburks/nu/issues/59 .