That's because on the right and @[A, T, T, G, C] is a `seq[Nucleotide], the 
type is inferred from the type of the first item.

If you explicitly ask for a DNANuc on the first item it will work, for instance:
    
    
    type
      Nucleotide = enum
        T, A, G, C, U
      
      DNANuc = range[T..C]
      RNANuc = range[A..U]
    
    echo high(DNANuc)
    
    var dnaseq1: seq[DNANuc] = @[]
    dnaseq1.add(A)
    dnaseq1.add(T)
    dnaseq1.add(T)
    dnaseq1.add(G)
    dnaseq1.add(C)
    echo dnaseq1
    
    # the following line gives a type mismatch error
    var dnaseq2: seq[DNANuc] = @[DNANuc A, T, T, G, C]
    echo dnaseq2
    
    
    Run

Reply via email to