mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
22 lines
327 B
Nim
22 lines
327 B
Nim
discard """
|
|
output: '''123
|
|
1
|
|
2
|
|
3'''
|
|
"""
|
|
|
|
import sequtils
|
|
# https://github.com/Araq/Nim/issues/797
|
|
proc foo[T](s:T):string = $s
|
|
|
|
type IntStringProc = proc(x: int): string
|
|
|
|
var f1 = IntStringProc(foo)
|
|
var f2: proc(x: int): string = foo
|
|
var f3: IntStringProc = foo
|
|
|
|
echo f1(1), f2(2), f3(3)
|
|
|
|
for x in map([1,2,3], foo): echo x
|
|
|