Welcome to the new forums!
Started by arquebus, May 02, 2012, 08:42:57 PM
Code Select Expand(define (sum f n) (set 'result 0) (for (i 1 n) (inc result (f i))) result); works because no clash of free j in f with i in sum(for (j 1 5) (define (f x) (pow x j)) (println j ": " (sum f 10))); does not work, free i in f clashes with i in sum(for (i 1 5) (define (f x) (pow x i)) (println i ": " (sum f 10))); works with previous expansion of free variable(for (i 1 5) (letex (e i) (define (f x) (pow x e))) ; expansion of free variable (println i ": " (sum f 10)))
Code Select Expand1: 552: 3853: 30254: 253335: 2208251: 1.040507132e+102: 1.040507132e+103: 1.040507132e+104: 1.040507132e+105: 1.040507132e+101: 552: 3853: 30254: 253335: 220825
Quote from: "arquebus"I also plan to learn emacs which means I will learn elisp, so I am now much more motivated to thoroughly understand elisp now...
Quote from: "arquebus"
Quote from: "abaddon1234"the fact that the reason for using dynamic scope requires a deeper understanding of Lisp is of course a good thing.
Quote from: "abaddon1234"
Quote from: "abaddon1234"https://www.gclub88.com/">gclub online
Quote from: rickyboy on June 24, 2016, 10:55:52 AMAgain, you should be banned from this forum.