Last active
August 29, 2015 14:19
-
-
Save davidrupp/8ecce770be8cadc77f70 to your computer and use it in GitHub Desktop.
Revisions
-
davidrupp revised this gist
Apr 23, 2015 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ (def thing 1) ; general form is ; (alter-var-root var-to-be-altered ; function-to-apply-to-old-value) (alter-var-root #'thing inc) ; value of thing is now 2 ; equivalently ... (alter-var-root #'thing (fn [old-val] (inc old-val))) ; value of thing is now 3 -
davidrupp revised this gist
Apr 23, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ (def thing 1) ; general form is (alter-var-root var-to-be-altered function-to-apply-to-calculate-the-new-value) (alter-var-root #'thing inc) ; value of thing is now 2 ; equivalently ... (alter-var-root #'thing (fn [old-val] (inc old-val))) ; value of thing is now 3 -
davidrupp created this gist
Apr 23, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ ; general form is (alter-var-root var-to-be-altered function-to-apply-to-calculate-the-new-value) (def thing 1) (alter-var-root #'thing inc) ; value of thing is now 2 ; equivalently ... (alter-var-root #'thing (fn [old-val] (inc old-val))) ; value of thing is now 3 ; also equivalently ... (alter-var-root #'thing #(inc %1)) ; value of thing is now 4