Jul 28, 2005 #1 sl1200mk2 Technical User Jun 7, 2005 39 FR hi i'm looking for a way to do this job: i've got +1 +2 +3 +4 +5 +6 -2 -4 i want 1 3 5 6 or +1 +4 +6 +3 +5 +2 -1 -3 want 4 6 5 2 any ideas are welcome thanks nicolas
hi i'm looking for a way to do this job: i've got +1 +2 +3 +4 +5 +6 -2 -4 i want 1 3 5 6 or +1 +4 +6 +3 +5 +2 -1 -3 want 4 6 5 2 any ideas are welcome thanks nicolas
Jul 28, 2005 #2 Bong Programmer Dec 22, 1999 2,063 US Maybe I'm missing something here. What is the criterion for picking the numbers you want? _________________ Bob Rashkin rrashkin@csc.com Upvote 0 Downvote
Maybe I'm missing something here. What is the criterion for picking the numbers you want? _________________ Bob Rashkin rrashkin@csc.com
Jul 28, 2005 Thread starter #3 sl1200mk2 Technical User Jun 7, 2005 39 FR hi bong the filter is done with - sign in words : 1)look for number with - sign 2)remove all number equal to those with the - sign 3) remove number with - sign if i have +1 +2 +6 +200 +4 +9 +73 -6 -73 the result should be 1 2 200 4 9 someone helped me for this job one result is % proc filter data { foreach item $data { set uns [expr {abs($item)}] if {$item > 0} { set res($uns) {} } else { unset -nocomplain res($uns) } } array names res } % set d {+1 +4 +6 +3 +5 +2 -1 -3} +1 +4 +6 +3 +5 +2 -1 -3 % filter $d 4 5 2 6 some are really good TCLers......... thanks for your post best regards nico Upvote 0 Downvote
hi bong the filter is done with - sign in words : 1)look for number with - sign 2)remove all number equal to those with the - sign 3) remove number with - sign if i have +1 +2 +6 +200 +4 +9 +73 -6 -73 the result should be 1 2 200 4 9 someone helped me for this job one result is % proc filter data { foreach item $data { set uns [expr {abs($item)}] if {$item > 0} { set res($uns) {} } else { unset -nocomplain res($uns) } } array names res } % set d {+1 +4 +6 +3 +5 +2 -1 -3} +1 +4 +6 +3 +5 +2 -1 -3 % filter $d 4 5 2 6 some are really good TCLers......... thanks for your post best regards nico