Thanks, these two solutions looks good
    
    
    values.foldl(a + b, 0)
    values.toSeq.foldl(a+b)
    
    
    Run

As for the `template` version - hmm, don't like it, as it would continue to 
contaminate the source code with even more "special" functions. For example if 
implemented that way the following code would fail.
    
    
    import sequtils
    
    template sum*(values: openArray[float]):float = values.foldl(a+b)
    
    proc mean(values: openArray[float]):float = values.sum / values.len.to_float
    
    echo mean(@[1.0, 2.0])
    
    
    Run

Reply via email to