Re: Error: variable i cannot be read at compile time

2018-01-08 Thread Vino via Digitalmars-d-learn
On Monday, 8 January 2018 at 08:22:21 UTC, thedeemon wrote: On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. Ah, sorry, now I think I ge

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. Ah, sorry, now I think I get it. Your problem is you get output like ["a","b","c"] and i

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. ... Using the function countUntil find the keys for each of the column and store the res

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread Vino via Digitalmars-d-learn
On Monday, 8 January 2018 at 05:38:44 UTC, thedeemon wrote: On Sunday, 7 January 2018 at 17:30:26 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. You've said before you nee

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread thedeemon via Digitalmars-d-learn
On Sunday, 7 January 2018 at 17:30:26 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. You've said before you need 6 different files, not some tables. Also, after the "compre

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread Vino via Digitalmars-d-learn
On Sunday, 7 January 2018 at 17:23:20 UTC, thedeemon wrote: On Sunday, 7 January 2018 at 12:59:10 UTC, Vino wrote: Just noticed that the output writes the data and key as 2 values , but the requirnment is to write to six files, e.g That's the part you can implement yourself. Just replace thos

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread thedeemon via Digitalmars-d-learn
On Sunday, 7 January 2018 at 12:59:10 UTC, Vino wrote: Just noticed that the output writes the data and key as 2 values , but the requirnment is to write to six files, e.g That's the part you can implement yourself. Just replace those writelns with writing to corresponding files.

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread Vino via Digitalmars-d-learn
On Sunday, 7 January 2018 at 12:09:32 UTC, Vino wrote: On Saturday, 6 January 2018 at 15:32:14 UTC, thedeemon wrote: On Saturday, 6 January 2018 at 06:47:33 UTC, Vino wrote: [...] Here's a version with Array, it's very similar: import std.algorithm: countUntil, joiner, sort, uniq, map; impor

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread Vino via Digitalmars-d-learn
On Saturday, 6 January 2018 at 15:32:14 UTC, thedeemon wrote: On Saturday, 6 January 2018 at 06:47:33 UTC, Vino wrote: [...] Here's a version with Array, it's very similar: import std.algorithm: countUntil, joiner, sort, uniq, map; import std.csv: csvReader; import std.stdio: File, writeln; i

Re: Error: variable i cannot be read at compile time

2018-01-06 Thread thedeemon via Digitalmars-d-learn
On Saturday, 6 January 2018 at 06:47:33 UTC, Vino wrote: On Friday, 5 January 2018 at 18:00:34 UTC, thedeemon wrote: On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course. Hi D

Re: Error: variable i cannot be read at compile time

2018-01-06 Thread Vino via Digitalmars-d-learn
On Saturday, 6 January 2018 at 06:47:33 UTC, Vino wrote: On Friday, 5 January 2018 at 18:00:34 UTC, thedeemon wrote: On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course. Hi D

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread Vino via Digitalmars-d-learn
On Friday, 5 January 2018 at 18:00:34 UTC, thedeemon wrote: On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course. Hi Deemon, Thank you very much, I tested your code, initiall

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course.

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 17:50:13 UTC, thedeemon wrote: Here's my version of solution. I've used ordinary arrays instead of std.container.array, since the data itself is in GC'ed heap anyway. I used csv file separated by tabs, so told csvReader to use '\t' for delimiter. And since lines o

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 13:09:25 UTC, Vino wrote: 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

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread Vino via Digitalmars-d-learn
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

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread Vino via Digitalmars-d-learn
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 wha

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
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.

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread Vino via Digitalmars-d-learn
On Friday, 5 January 2018 at 12:10:33 UTC, thedeemon wrote: On Friday, 5 January 2018 at 09:09:00 UTC, Vino wrote: Thank you very much, can you suggest the best way around this issue. What exactly are you trying to do in Master()? The code seems very broken. Each time you write read[i] is w

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 09:09:00 UTC, Vino wrote: Thank you very much, can you suggest the best way around this issue. What exactly are you trying to do in Master()? The code seems very broken. Each time you write read[i] is will call read() and read the whole file, you're going to rea

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread Vino via Digitalmars-d-learn
On Thursday, 4 January 2018 at 18:49:21 UTC, Ali Çehreli wrote: On 01/04/2018 08:51 AM, Vino wrote: > auto read () { [...] > return tuple(Ucol1, Ucol2, Ucol3, rSize); > } read() returns a tuple of values of different types. > for(int i = 0; i < Size; i++) { > typeof(read()[i]) Datacol; typeof

Re: Error: variable i cannot be read at compile time

2018-01-04 Thread Ali Çehreli via Digitalmars-d-learn
On 01/04/2018 08:51 AM, Vino wrote: > auto read () { [...] > return tuple(Ucol1, Ucol2, Ucol3, rSize); > } read() returns a tuple of values of different types. > for(int i = 0; i < Size; i++) { > typeof(read()[i]) Datacol; typeof is a compile-time expression but there cannot be a consistent r

Error: variable i cannot be read at compile time

2018-01-04 Thread Vino via Digitalmars-d-learn
Hi All, Request your help on the below error for the below program. Error: CReadCol.d(20): Error: variable i cannot be read at compile time CReadCol.d(21): Error: variable i cannot be read at compile time CReadCol.d(22): Error: variable i cannot be read at compile time Program import