# Tag Info

## Hot answers tagged list-manipulation

...
• 74.7k

### Counting consecutive units in nested lists

Max /@ Total[(Split /@ lst), {3}] (* {2, 3, 5, 7, 13} *) ...
• 19.4k

### Counting consecutive units in nested lists

You could also split on the 1-sequences: Max[SequenceSplit[#, ones : {1 ..} :> Length[ones]]] & /@ list Or SequenceCases:...
• 29.1k

### Recovering indices from an expression

Oh dear... I was working too hard. This will do it. ...
• 471
Accepted

### Counting consecutive units in nested lists

Using LongestCommonSubsequence ...
• 4,536

### Recovering indices from an expression

For expr = U[1, 3] U[1, 4] U[1, 5] U[2, 2] U[3, 1]; you can do {firstindex, secondindex} = Transpose[List @@@ List @@ expr] or ...
• 23.8k

### Recovering indices from an expression

Given, expression = U[1, 3] U[1, 4] U[1, 5] U[2, 2] U[3, 1] you could use Cases: ...
• 29.1k

### Counting consecutive units in nested lists

If we look at your problem in a simplistic manner, we could see a function that increments by receiving 1 and resets by receiving 0 (like multiplying but with an increment). Since we need the result ...
• 9,319

### How can I construct this matrix?

n = 5; Table[RotateRight[Range[n], i], {i, 0, n - 1}] // MatrixForm ...
• 74.7k

### How to add zeros before and after each element in a list?

Using Splice list={0.2,0.5,0.7}; Take[Riffle[list, Splice[{0, 0}], {1, -1, 2}], {2, -2}];
• 61

### Get alphabetical number of characters in string

str = "abcdefghijklmnopqrstuvwxyz"; Using LetterNumber (new in 10.1) ...
• 74.7k

### Finding position of non empty matrix entries

list = {{}, {1, 2}, {}, {3, 4}, {}, {}, {}}; Using Position and DeleteCases ...
• 74.7k

### Creating a conditional table

list = {7, 0, 8, 2, 1, 5, 8, 0, 6, 7}; Using FirstPosition (new in 10.0) to catch missing values 1. The 3rd parameter of ...
• 74.7k

### Creating a new list from an existing one

data = { {{1, -1}, {2, 5}, {3, 9}, {4, 2}}, {{1, -4}, {2, 0}, {3, 11}, {4, -1}}, {{1, 3}, {2, 2}, {3, 22}, {4, 1}}, {{1, 0}, {2, 0}, {3, -5}, {4, 7}} }; ...
• 74.7k

### Construct a list from another list

lst = Range[24] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24} Using ...
• 25.2k

...
• 74.7k

### Replace elements of a list based on a function

Also: f = Table[3*k*k, {k, 1, 16}]; f^ ArrayPad[{1, 1, 1, 1, 0, 0, 0, 0}, {0, Length@f - 8}, "Periodic"] ...
• 4,536

### Replace elements of a list based on a function

f = Table[3*k*k, {k, 1, 16}]; Using SequenceCases ...
• 74.7k

### Replacing a sub-partition (unordered list; multiset)

list = {{4, 4, 2, 2, 1, 1, 1}, {4, 4, 2, 2, 2, 1}}; A variant of 1066's answer using SequenceReplace (new in 11.3) ...
• 74.7k

### How to use StringJoin in the given example?

list = {{"abc", "0000"}, {"def", "1111"}}; Using the operator form of Insert ...
• 74.7k

...
• 74.7k
1 vote

### How to create an array from all combinations of the vector components?

la = {a, b, c}; lb = {w, x, y, z}; A variant of E. Chan-López first answer using Comap (new in 14.0) ...
• 74.7k
1 vote

### How to make an element in a list nested within a list have a default value?

list = {{{-2, -2}, 1}, {{-2, -5}, 2, 7}, {{1, 5}, 3, 9}, {{7, -7}, 4}}; Using ReplaceAll ...
• 74.7k
1 vote

### How do I remove parts of this data?

list = {{9.9, 0}, {"", ""}, {10.0, -21.7}, {"", ""}, {10.0, 28.5}, {"", ""}}; Using ...
• 74.7k
1 vote

### List of symbols wherein position encoded by number to string

list = {{"a", 6}, {"z", 1}, {"g", 2}, {"y", 12}}; Using SubsetMap (new in 12.0) ...
• 74.7k
1 vote

### How to substitute Table environments by a more sophisticated code

list = Range[12, 30]; Using SequenceCases ...
• 74.7k
1 vote

### Find list position and mapping list

...
• 74.7k

Only top scored, non community-wiki answers of a minimum length are eligible