I'm playing with Clojure's lazy sequences and I have interesting observation. When I execute following code:
(first (filter (fn [x] (do (println x) (= x 2))) (range 1000)))
I got output:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
=> 2
So, it seems that pred was called against first 32 elements of seq. Two questions occurs: why 32, and why pred was executed at all after second element?