identifying the "1" in a list

Feb 2, 2006 at 3:33pm

identifying the "1" in a list

Looking for an elegant way of doing the following:

I have a list that will consist of variable number of integers. The
values of the integers will only be 0 or 1. There will only be one
occurrence of the 1 integer; all the rest will be 0.

I want to know at which position in the list the 1 occurs.

Right now, I am using a combination of iter, select, and counter, but
it seems clunkier than it needs to be. Is there another object that
will make this easier?

Thanks
Dan

Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X
http://www.defectiverecords.com

http://www.jackosx.com

#24236
Feb 2, 2006 at 3:50pm

zl sub will do exactely that.

#69795
Feb 2, 2006 at 3:57pm

#69796
Feb 2, 2006 at 3:59pm

#69797
Feb 2, 2006 at 4:01pm

#69798
Feb 2, 2006 at 4:24pm

#69799
Feb 2, 2006 at 4:25pm

#69800
Feb 2, 2006 at 5:38pm

#69801

You must be logged in to reply to this topic.