Q: Is There Any Negation in English Language? A: No!
Posted: Fri Jun 12, 2009 2:36 pm
(exists nil? '(1 2 nil 3)) => nil
(exists nil? '(1 2 3)) => nil
i.e. exists doesn't return sensible result for predicate nil?. I could replace this particular (exists nil? ...) with (find nil ...) but exists also doesn't work for all other predicates satisfied by nil, because returned nil cannot be interpreted. Unfortunately, there are numerous such cases, and some are important.
(exists logical-constant? '(x y z nil true)) => nil
I think that exists should return only true and false (nil), just like its dual for-all. Other part of the functionality, find-the-first-satisfying can be defined independently. (Overloading existing find causes the problems similar to existing ones.) Alternatively, index of the first element satisfying predicate, or even pair (index value) could be returned from exists - instead of value. I guess that one function - one functionality approach has the least chance to cause problems.
(exists nil? '(1 2 3)) => nil
i.e. exists doesn't return sensible result for predicate nil?. I could replace this particular (exists nil? ...) with (find nil ...) but exists also doesn't work for all other predicates satisfied by nil, because returned nil cannot be interpreted. Unfortunately, there are numerous such cases, and some are important.
(exists logical-constant? '(x y z nil true)) => nil
I think that exists should return only true and false (nil), just like its dual for-all. Other part of the functionality, find-the-first-satisfying can be defined independently. (Overloading existing find causes the problems similar to existing ones.) Alternatively, index of the first element satisfying predicate, or even pair (index value) could be returned from exists - instead of value. I guess that one function - one functionality approach has the least chance to cause problems.