Hi I just discovered the neat feature in nim of allowing conversions of 
parameters before it enters the actual proc. I'm curious however if there's a 
version of this that allows for a single parameter instead of an array of them?

An example for anyone to play around with:
    
    
    proc toRange(a: HSlice[int, int]): HSlice[int,int] = a
    proc toRange(a: int): HSlice[int,int] = a..a
    
    proc toIntSeq(a: varargs[HSlice[int, int], toRange]): seq[int] =
      for r in a:
        for v in r:
          result.add(v)
    
    
    echo toIntSeq(20)
    echo toIntSeq(0..5)
    echo toIntSeq(0..5, 2) # This should error since we only want one.
    
    
    Run

<https://play.nim-lang.org/#pasty=PscNQBhP>

I know there are probably ways around this (like maybe having several toIntSeq 
overloads), but I was just curious if you could do it with a singular parameter 
instead? 

Reply via email to