Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement