Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created January 2, 2011 21:03
Show Gist options
  • Save mattpodwysocki/762812 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/762812 to your computer and use it in GitHub Desktop.
Testing LINQ
user=> (import 'System.Linq.Enumerable)
System.Linq.Enumerable
user=> (def r1 (Enumerable/Range 1 10))
#'user/r1
user=> (seq r1)
(1 2 3 4 5 6 7 8 9 10)
user=> (def r2 (. Enumerable (generic Repeat Int32) 3 4))
#'user/r2
user=> (seq r2)
(3 3 3 3)
user=> (def r3 (. Enumerable (generic Where Int32) r1 (sys-func [Int32 Boolean] [x] (even? x))))
#'user/r3
user=> (seq r3)
(2 4 6 8 10)
user=> (def r4 (. Enumerable (generic Count Int32) r1))
#'user/r4
user=> (println r4)
10
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment