Skip to content

Instantly share code, notes, and snippets.

@cjfrisz
Created November 5, 2012 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjfrisz/4020522 to your computer and use it in GitHub Desktop.
Save cjfrisz/4020522 to your computer and use it in GitHub Desktop.
Recur effectively disallowed as local function binding
;; Does this bother anybody else?
((fn [x] (let [recur (dec x)] (if (zero? x) 42 (recur recur)))) 5)
;;=> 42
;; Similarly
((fn [x] (let [recur (fn [y] 350)] (if (zero? x) 42 (recur (dec x))))) 5)
;;=> 42
;; Apparently 'recur' in function position *always* refers to the 'recur' special form
;; Doesn't seem that the identifier can be rebound
@erjiang
Copy link

erjiang commented Nov 7, 2012

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment