I'm reaching out to see if there are anyone that could point me to the right direction. I have a program that produces an array of booleans that consist of either false(0) og true(1). Like this: [0,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,1,1,0,0,1,0]
.
This array is usually between 50 and 400 long. Instead of showing the whole array to the end user I want to make it more "readable". One of the things I have to do is to split in into smaller repeatable chunks of arrays that shows how many times it should repeated (1 to n times). I'll give som examples:
Example number 1 simple:
Before: [1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1]
After: [1,0,1]*7 time,
Example number 1 more complex:
Before: [1,1,1,0,1,1,0,1,1,0,1,1,0,1,0,0,1,0,1,1,0,1]
After: [1,1]*1 time, [1,0,1]*4 times, [0,0] *1 time, [1,0,1]*2 times
As you can see from the examples both before and after is actually the same but only different way of printing it.
Remember that in my program I can have bigger arrays (size up to 400). And often it is much easier to print out (to the user) [1,0,1,1]* 55 than [1,0,1,1,...< long array>...,1,0,1,1]
Edit: The main goal is to make the array easier to read, since it will be read 1 by 1 (by a human).
So '01'*22 rather than '01010101010101010101010101010101010101010101'
And also I would prefer a higher multiplication number rather than a low one.
'01'*22 is better than '0101'*11 which is better than '010101'*7 + '01'*1