Modify the program so that it prints the decompressed data.
The compressed data is 1, 4, 3, 9, 5, 3, 2, 7, 0. The program currently just prints all these values except the terminating zero. When properly decompressed, the output should be:
4 9 9 9 3 3 3 3 3 7 7
Modify the program to print out the decompressed data. To do this you need to realize that the data comes in pairs like 5, 3. This first value in the pair is the number of times the second value is to be repeated. So set up a nested, inner loop to execute this number of times, and print the second value in the pair inside this inner loop.
The dumbfuck didn't give much of an explination on how to do it.
Name:
Anonymous2007-06-17 19:51 ID:SjJB4bwy
It would help if you posted the program you're supposed to modify.
Name:
Anonymous2007-06-17 19:58 ID:/qzsph9W
That's the problem. The guy didn't leave me the program to modify. Asshole! Anyways, I'll provide the picture by my photobucket:
>>8
actually, i can do this instead, just because it looks nicer this way: { 1 4 3 9 5 3 2 7 0 } [ reverse [ ] each 4 [ [ dup # " " % ] times drop ] times drop ] " " make print
>>23
Well I am learning J. I understand what it does when you give it a vector but in >>22 I gave it a 2xn array and I have no idea how it gave the result.