Timeline for How do I check if any element in a list is positive?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 2, 2014 at 11:53 | comment | added | Simon Woods | @Kuba, the OP was specifically asking for a functional method, so it's not surprising that this procedural loop is not highly voted :-) | |
| Feb 2, 2014 at 10:19 | comment | added | Kuba | This is what I've thought first. I'm amazed it is 5th answer not 2nd. @Mr.Wizard It deserves vote for a method :) I would say that testing all elements when OP wants to know if any is positive seems an overkill ;) | |
| Jul 31, 2012 at 17:38 | comment | added | Yves Klett | Tr is shorter ;-) although similar in spirit the timing is different for Clip and UnitStep approaches. | |
| Jul 31, 2012 at 12:39 | comment | added | Simon Woods | @YvesKlett, it's not so much that I don't like your answer, I just thought it was essentially the same algorithm Rojo's UnitStep approach. By the way, why Tr and not Total ? | |
| Jul 31, 2012 at 12:34 | comment | added | Simon Woods | @Mr.Wizard, I agree that it's overkill :-) Especially as the OP was explicitly trying to avoid clumsy loops. | |
| Jul 31, 2012 at 12:14 | comment | added | Yves Klett | Somehow after @Mr.Wizard's review no one likes my approach. I'll go and have a proper cry ;-) | |
| Jul 31, 2012 at 12:08 | comment | added | Mr.Wizard | This is surely the optimal way to approach this problem (though likely overkill for the OP). Unfortunately I cannot test it in v7, and as a rule I don't vote for v8-only answers. Not because such answers are not good, but because I think it is important to test things, and it would be unfair to vote for some v8 answers and not others. | |
| Jul 31, 2012 at 12:00 | history | answered | Simon Woods | CC BY-SA 3.0 |