+http://localhost:8003/live.html#code=%23%20Higher-order%20functions%0A%23%20Adapted%20from%20MIT%206.01%20course%20notes%20(Section%20A.2.2%29%0A%23%20http%3A//mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf%0A%0Adef%20summation(low,%20high,%20f,%20%20next%29%3A%0A%20%20%20%20s%20%3D%200%0A%20%20%20%20x%20%3D%20low%0A%20%20%20%20while%20x%20%3C%3D%20high%3A%0A%20%20%20%20%20%20%20%20s%20%3D%20s%20%2B%20f(x%29%0A%20%20%20%20%20%20%20%20x%20%3D%20next(x%29%0A%20%20%20%20return%20s%0A%0Adef%20sumsquares(low,%20%20high%29%3A%0A%20%20%20%20return%20summation(low,%20high,%20lambda%20x%3A%20x**2,%20lambda%20x%3A%20x%2B1%29%0A%0Aprint(sumsquares(1,%20%2010%29%29&cumulative=false&curInstr=69&heapPrimitives=false&mode=display&origin=opt-live.js&py=2&rawInputLstJSON=%5B%5D&textReferences=false
0 commit comments