Snippets tagged arrays

  • Extensions to the Fold function

    This snippet is helpfull in the following cases: 1) After a consolidation operation using the fold function we need to know how many elements have been processed. 2) A consolidation operation needs to use the index of each of the elements processed and we don't want to use the mapi function first. 3) A combination of the above. Since the following snippet just adds a wrapper to the existing Fold function we can repeat the approach for arrays and sequences (including the plinq ones)

    31 people like this

    Posted: 13 years ago by Horacio Nuñez

  • Pluck and TryPluck

    Functions to select the first element in an array that passes some predicate, and separately all the other array elements. (I'm not sure if this type of operation has a standard name. Please tweet me if you know!)

    8 people like this

    Posted: 9 years ago by Kit Eason