Re: Fastest Way to...
- Posted by euphoriCK <euphoric at cklester.com> Oct 28, 2003
- 376 views
Derek Parnell wrote: >>I've got a 3-element sequence... >> >> { 3, -1, 0 } >> >>and need to turn it into this >> >> { 1, -1, 0 } >> >>That is, any positive values ( > 0 ) should be turned to one. >> >> >Maybe this... > > pos = pos * (pos <= 0) + (pos > 0) > > Oh, sweet! I think my version coulda been that if I had stayed with it. :)