Re: Fastest Way to...

new topic     » goto parent     » topic index » view thread      » older message » newer message

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. :)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu