Error: variable i cannot be read at compile time

Vino vino.bheeman at hotmail.com
Fri Jan 5 13:09:25 UTC 2018


On Friday, 5 January 2018 at 12:47:39 UTC, thedeemon wrote:
> On Friday, 5 January 2018 at 12:40:41 UTC, Vino wrote:
>>> What exactly are you trying to do in Master()?
>>   Please find the full code,
>
> Sorry, I'm asking what problem are you solving, what the 
> program should do, what is its idea. Not what code you have 
> written.

Hi,

I am trying to implement data dictionary compression, and below 
is the function of the program,

Function read:
This function read a csv file which contains 3 column as and 
stores the value of each column in an array Col1: Array1 (Ucol1), 
Col2: Array2 (Ucol2), Col3: Array3(Ucol3) and returns the data.

CSV file content:
Miller	America	23
John	India	42
Baker	Australia	21
Zsuwalski	Japan	45
Baker	America	45
Miller	India	23

Function Main
This function receives the data from the function read.
Creates an array based of the function return type – ( 
typeof(read()[i]) Data );
Sorts the data and removes the duplicates and stores the data in 
the above array.
Then using “countUntil” function we can accomplish the data 
dictionary compression.

Result
The above file will be stored as
Data File:
Data-Col1.txt which contains [Baker, John, Miller, Zsuwalski]
Data-Col2.txt which contains [America, Australia , India, Japan]
Data-Col3.txt which contains [21, 23, 42, 45]

Index File:
Index-Col1.txt which contains [2, 1, 0, 3, 0, 2]
Index -Col2.txt which contains [0, 2, 1, 3, 0, 2]
Index -Col3.txt which contains [1, 2, 0, 3, 3, 1]

The program works for a single column.

From,
Vino.B



More information about the Digitalmars-d-learn mailing list