On Friday, 5 January 2018 at 13:09:25 UTC, Vino wrote:
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 Info:
If we change the below line
static foreach(i; 0 .. 1)
Output: ["Baker", "John", "Miller", "Zsuwalski"][2, 1, 0, 3, 0, 2]
static foreach(i; 1 .. 2)
["America", "Austrilia", "India", "Japan"][0, 2, 1, 3, 0, 2])
static foreach(i; 2 .. 3)
[21, 23, 42, 45][1, 2, 0, 3, 3, 1]
Instead of manually chaning the values I used the variable Size
where the value of the Size if from the read function (read[3] )
where read[3] is rSize = record.length;
If I use the variable Size as static foreach(i; 0 .. Size) I am
getting an error : “Error: variable Size cannot be read at
compile time”.
From,
Vino.B