clojure - ANDing a boolean and a list -


i've noticed in scheme, racket, , clojure expression (using clojure here) (and true '()) evaluates (), , (and '() true) evaluates true. true not empty list, list.

but in gnu clisp , emacs lisp, (and t '()) evaluates nil , (and '() t) evaluates nil also, (and t '(1 2 3)) evaluates (1 2 3) , (and '(1 2 3) t) evaluates t.

what going on here?

in first group of languages, empty list not treated 'falsey' , instead treated 'truthy' value. in scheme , racket, #false false value though '() null, null not false; in clojure empty list not same nil, 'truthy' there well.

in second group, empty list synonym nil , treated false, leading condition return nil. list elements not same nil, , treated truthy value again.

the final piece of puzzle and returns last truthy value if values passed truthy.


Comments

Popular posts from this blog

xcode - CocoaPod Storyboard error: -

c# - AutoMapper - What's difference between Condition and PreCondition -