Merge pull request #3234 from petermora/mapAutoAuto
extending metatype matching in sigmatch.nim
This commit is contained in:
commit
19f58704ee
2 changed files with 70 additions and 5 deletions
10
tests/metatype/tprocbothmeta.nim
Normal file
10
tests/metatype/tprocbothmeta.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
proc myFun[A,B](x: A): B =
|
||||
result = float(x+10)
|
||||
|
||||
proc myMap[T,S](sIn: seq[T], f: proc (q: T): S): seq[S] =
|
||||
result = newSeq[S](sIn.len)
|
||||
for i in 0..<sIn.len:
|
||||
result[i] = f(sIn[i])
|
||||
|
||||
assert myMap(@[1,2,3], myFun) == @[11.0, 12.0, 13.0]
|
||||
Loading…
Add table
Add a link
Reference in a new issue