SHOW:
|
|
- or go back to the newest paste.
| 1 | (defn pls1 [x] | |
| 2 | (+ 1 x)) | |
| 3 | ||
| 4 | (defn pls2 [x] | |
| 5 | (+ 2 x)) | |
| 6 | ||
| 7 | (defn doit [] | |
| 8 | (map (fn [i f] | |
| 9 | (f i)) | |
| 10 | '(1 2 3 4 5) | |
| 11 | (cycle '(pls1 pls2)))) | |
| 12 | ;produces (nil nil nil nil nil) | |
| 13 | ||
| 14 | (defn doit [] | |
| 15 | (map (fn [i f] | |
| 16 | (pls2 i)) | |
| 17 | '(1 2 3 4 5) | |
| 18 | (cycle '(pls1 pls2)))) | |
| 19 | ;produces (3 4 5 6 7) | |
| 20 | - | ;while this works for some and produces (2 3 4 5 6) |
| 20 | + | |
| 21 | (defn doit [] | |
| 22 | (map (fn [i f] | |
| 23 | (+ 1 i)) | |
| 24 | '(1 2 3 4 5) | |
| 25 | (cycle '(pls1 pls2)))) | |
| 26 | ;produces (2 3 4 5 6) |