list issue: report index if value is 1


    Apr 20 2010 | 7:42 am
    I need to report the index numbers of an incoming list if the value is 1.
    f.e. if the list looks like this:
    0 1 1 0 1
    the result should be like this:
    2 3 5
    Hope this makes senses!
    Thanks.

    • Apr 20 2010 | 8:15 am
      Hi,
      here is one of many ways :
    • Apr 20 2010 | 8:27 am
      Using [zl sub] is probably the quickest way.
      lh
    • Apr 20 2010 | 8:36 am
      Lsearch from the Lobjects collection does this, other than it treating lists as 0 based, which means that it would return 1 2 4. Slap an Ladd after the Lsearch for your one-based desired result.