summary refs log blame commit diff stats
path: root/tests/closure/tcapture.nim
blob: 304a76285fb68cfcc474292fc67fcc4b41341ad6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                                         
discard """
  output: '''
to be, or not to be'''
  joinable: false
"""

import sequtils, sugar

let m = @[proc (s: string): string = "to " & s, proc (s: string): string = "not to " & s]
var l = m.mapIt(capture([it], proc (s: string): string = it(s)))
let r = l.mapIt(it("be"))
echo r[0] & ", or " & r[1]