Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. (defn long-inc [x]
  2. (do
  3. (println "Calculating...")
  4. (inc x)))
  5.  
  6. (long-inc 8)
  7. ;; Calculating...
  8. ;; 9
  9.  
  10. (long-inc 8)
  11. ;; Calculating...
  12. ;; 9
  13.  
  14. (def memoized-long-inc (memoize long-inc))
  15.  
  16. (memoized-long-inc 8)
  17. ;; Calculating...
  18. ;; 9
  19.  
  20. (memoized-long-inc 8)
  21. ;; 9
  22.  
  23. (memoized-long-inc 1815)
  24. ;; Calculating...
  25. ;; 1816
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement