Guest User

Untitled

a guest
May 24th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import sequtils
  2.  
  3. let powersOfTwo = @[1, 2, 4, 8, 16, 32, 64, 128, 256]
  4.  
  5. echo powersOfTwo.filter do (x: int) -> bool : x > 32
  6. echo powersOfTwo.filter(proc (x: int): bool = x > 32)
  7.  
  8. adam: [learn_nim] $ nim c -r filter.nim
  9. Hint: used config file '/home/adam/.choosenim/toolchains/nim-#devel/config/nim.cfg' [Conf]
  10. Hint: system [Processing]
  11. Hint: filter [Processing]
  12. Hint: sequtils [Processing]
  13. filter.nim(5, 17) Error: type mismatch: got (seq[int])
  14. but expected one of:
  15. proc filter[T](seq1: seq[T]; pred: proc (item: T): bool): seq[T]
Advertisement
Add Comment
Please, Sign In to add comment