Quick actions

cmd+k|ctrl+k

Navigation

Languages

Concept[Concept[T]] error

Snippet info

Language

Nim

Visibility

public

Author

7sdream

Created

2018-06-18T09:00:19Z

Updated

2018-06-22T07:40:05Z

type
  Iterable[T] = concept x
    for v in x:
      type(v) is T

proc map2[T, U](itit: Iterable[Iterable[T]], f: proc(_: T): U): seq[U] =
  result = @[]
  for it in itit:
    for v in it:
      result.add(f(v))

echo map2(@[@[1, 2, 3], @[4, 5, 6]], proc (x: int): int = x + 1)
INFO