Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn long-inc [x]
- (do
- (println "Calculating...")
- (inc x)))
- (long-inc 8)
- ;; Calculating...
- ;; 9
- (long-inc 8)
- ;; Calculating...
- ;; 9
- (def memoized-long-inc (memoize long-inc))
- (memoized-long-inc 8)
- ;; Calculating...
- ;; 9
- (memoized-long-inc 8)
- ;; 9
- (memoized-long-inc 1815)
- ;; Calculating...
- ;; 1816
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement