Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sequtils
- let powersOfTwo = @[1, 2, 4, 8, 16, 32, 64, 128, 256]
- echo powersOfTwo.filter do (x: int) -> bool : x > 32
- echo powersOfTwo.filter(proc (x: int): bool = x > 32)
- adam: [learn_nim] $ nim c -r filter.nim
- Hint: used config file '/home/adam/.choosenim/toolchains/nim-#devel/config/nim.cfg' [Conf]
- Hint: system [Processing]
- Hint: filter [Processing]
- Hint: sequtils [Processing]
- filter.nim(5, 17) Error: type mismatch: got (seq[int])
- but expected one of:
- proc filter[T](seq1: seq[T]; pred: proc (item: T): bool): seq[T]
Advertisement
Add Comment
Please, Sign In to add comment