The Way 2 Inner Peace.



Qians posted @ 2012年6月22日 20:35 in scheme with tags Scheme , 1731 阅读

来自The seasoned schemer

The Next Ten Commandments


The Eleventh Commandment

Use additional arguments when a function needs to know what other arguments to the function have been like so far.



The Twelfth Commandment

Use (letrec ...) to remove arguments that do not change for recursive applications.



The Thirteenth Commandment

Use(letrec ...) to hide and to protect functions.



The Fourteenth Commandment

Use(letcc1 ...) to return values abruptly and promptly.



The Fifteenth Commandment

Use (let ...) to name the values of repeated expressions in a function definition if they may be evaluated twice for one and t he same use of the function. And use (let...) to name the values of expressions(without set!) that are re-evaluated every time a function is used.



The Sixteenth Commandment

Use (set! ...)only with names defined in (let ...)s.



The Seventeenth Commandment

Use(set! x ...) for (let((x ...)) ...) only if there is at least one (lambda ... between it and the(let ...),or if the new value for x is a function that refers to x .



The Eighteenth Commandment

Use (set! x ...) only when the value that x refers to is no longer needed.



The Nineteenth Commandment

Use (set! ...) to remember valuable things between two distinct uses of a function.



The Twentieth Commandment

When thinking about a value created with (letcc ...),write down the function that is equivalent but does not forget. Then, when you use it, remember to forget.


1:letcc is call-with-current-continuation or call/cc in scheme

登录 *

loading captcha image...
or Ctrl+Enter