(def *forty-two* 42)

(defn impure-add42 [n]
  (+ n *forty-two*))

(impure-add42 1)
=> 43

(binding [*forty-two* 23]
  (impure-add42 1))
=> 65

On Sun, Jul 18, 2010 at 12:57 AM, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> Hi,
>
> 2010/7/17 Paul Richards <paul.richa...@gmail.com>
>>
>> The "Programming Clojure" book states: "Functions that use dynamic
>> bindings are not pure functions.."  (P2.0, page 174).
>>
>> I do not understand why this must be the case, can someone explain why?
>
> Because then the result of the function does not *only* depend on its input
> arguments.
>
>>
>> PS.  I tried to post this on the discussion page for the book
>> (http://forums.pragprog.com/forums/91), but I could not register and
>> login correctly.
>>
>> --
>> Paul Richards
>> @pauldoo
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to