www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - foreach loop + counter iter + Phobos range

reply "bioinfornatics" <bioinfornatics fedoraproject.org> writes:
hi why whith this code : http://dpaste.dzfl.pl/474dd9f6

i get these errors:
parser/fasta.d(171): Error: cannot infer argument types
parser/fasta.d(176): Error: undefined identifier index, did you 
mean template indexed(Source,Indices)?
parser/fasta.d(177): Error: undefined identifier index, did you 
mean template indexed(Source,Indices)?
parser/fasta.d(179): Error: undefined identifier index, did you 
mean template indexed(Source,Indices)?
parser/fasta.d(180): Error: undefined identifier index, did you 
mean template indexed(Source,Indices)?
parser/fasta.d(183): Error: undefined identifier 'header'


what is wrong at line 171 ? i am explicit i said i want a counter 
iterator and a Fasta struct!
Nov 20 2012
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
bioinfornatics:

 what is wrong at line 171 ? i am explicit i said i want a 
 counter iterator and a Fasta struct!
See: http://d.puremagic.com/issues/show_bug.cgi?id=5550 Bye, bearophile
Nov 20 2012
parent reply "bioinfornatics" <bioinfornatics fedoraproject.org> writes:
On Tuesday, 20 November 2012 at 11:33:23 UTC, bearophile wrote:
 bioinfornatics:

 what is wrong at line 171 ? i am explicit i said i want a 
 counter iterator and a Fasta struct!
See: http://d.puremagic.com/issues/show_bug.cgi?id=5550 Bye, bearophile
thanks i vote up for your request is really a need
Nov 20 2012
parent reply "bioinfornatics" <bioinfornatics fedoraproject.org> writes:
On Tuesday, 20 November 2012 at 12:32:45 UTC, bioinfornatics 
wrote:
 On Tuesday, 20 November 2012 at 11:33:23 UTC, bearophile wrote:
 bioinfornatics:

 what is wrong at line 171 ? i am explicit i said i want a 
 counter iterator and a Fasta struct!
See: http://d.puremagic.com/issues/show_bug.cgi?id=5550 Bye, bearophile
thanks i vote up for your request is really a need
I try to use : property Tuple!(size_t, Fastq) front(){ Tuple!(size_t, Fastq) result; result[0] = _i; result[1] = _extract( _sections[0] ); _i++; return result; } but it seem is not aggregate by the foreach loop :-(
Nov 20 2012
next sibling parent reply "bioinfornatics" <bioinfornatics fedoraproject.org> writes:
     foreach( size_t index, Fastq data; parallel( 
fastqFile.byFastq() ) ){
         assert(data.header   == fastqList[index].header  , text( 
"Error fastq n°", index, " do not have the right header"   ) );
         assert(data.sequence == fastqList[index].sequence, text( 
"Error fastq n°", index, " do not have the right sequence" ) );

-----
/usr/include/d/std/parallelism.d(3831): Error: delegate dg 
(Tuple!(ulong,Fastq)) is not callable using argument types (Fastq)
/usr/include/d/std/parallelism.d(3839): Error: delegate dg 
(ulong, Tuple!(ulong,Fastq)) is not callable using argument types 
(ulong,Fastq)
/usr/include/d/std/parallelism.d(3317): Error: template instance 
std.parallelism.ParallelForeach!(byFastq) error instantiating
     instantiatied in ../src/parser/fastq.d(237): 
parallel!(byFastq)
../src/parser/fastq.d(237): Error: template instance 
std.parallelism.parallel!(byFastq) error instantiating
../src/parser/fastq.d(237): Error: cannot uniquely infer foreach 
argument types



fastqFile.byFastq() return a Tuple!(ulong,Fastq) in this case 
foreach fail to aggregate correctly
Nov 20 2012
parent "bearophile" <bearophileHUGS lycos.com> writes:
bioinfornatics:

 fastqFile.byFastq() return a Tuple!(ulong,Fastq) in this case 
 foreach fail to aggregate correctly
Try to minimize the code that produces this problem, so if it's a real problem it becomes fodder for Bugzilla. Bye, bearophile
Nov 20 2012
prev sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
bioinfornatics:

 but it seem is not aggregate by the foreach loop :-(
Generally if you want to help who gives help you have to show the full code (or its compilable reduction) and copy&paste the error you get... Bye, bearophile
Nov 20 2012