<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 2, 2009, at 7:57 AM, Grant Rettke wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Tue, Dec 30, 2008 at 11:44 PM, Richard Cleis &lt;<a href="mailto:rcleis@me.com">rcleis@me.com</a>> wrote:<br><blockquote type="cite">On Dec 30, 2008, at 9:12 PM, Grant Rettke wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Why do layman (working programmers) care about Currying? Or how are<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">they applied in daily use to help one out?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm not sure if you are referring to 'using a function that curries other<br></blockquote><blockquote type="cite">functions,' or if you mean (as the wikisnip says) "if you fix some<br></blockquote><blockquote type="cite">arguments, you get a function of the remaining arguments." I manually do the<br></blockquote><blockquote type="cite">latter frequently, and it's one of the reasons I like Scheme so much.<br></blockquote><br>I don't understand the practical application of currying in Scheme, so<br>I'm not asking about one or the other; the wikipedia link was just my<br>going in position on trying to understand what is currying.<br><br>When you do apply the latter, what are the idioms or patterns that you<br>most often encounter?</div></blockquote><div><br></div>I often encounter core functions of at least several arguments, most or all of which are results of independent computations of diverse complexity. &nbsp;Efficiency is enhanced by ordering the arguments by complexity and using Curry-related closures. &nbsp;The organization of the program tends to be more appealing to me since variables contain intermediate functions of specific meaning, rather than specific data that are used by a generally-named core function. In other words, Currying permits repeated use of intermediate functions as an alternative to overtly managing arguments to a core function.&nbsp;</div><div><br></div><div><blockquote type="cite"><div>I understand the idea of using bindings to capture state, but I don't<br>see how that translates into normal usage. For example, if you write<br><br>(define (((foo a) b) c)<br> &nbsp;(λ () (do-something-to a b c)))<br><br>you will get a function back 3 times, but only the third time is the<br>result you expect. How do you know when to stop, keep track of how<br>many times you called it? Is this a good example?<br></div></blockquote><br></div><div><div>The earlier post,&nbsp;</div><div><br></div><div><a href="http://list.cs.brown.edu/pipermail/plt-scheme/2009-January/029418.html">http://list.cs.brown.edu/pipermail/plt-scheme/2009-January/029418.html</a></div><div><br></div><div>is a specific example of producing intermediate functions using keywords. Below is a way to use the Currying form that you present. &nbsp;The function that would return 'earth' is used much less often than the core function. &nbsp;The function that would return 'telescope' is used more often, but not as much as the core function. &nbsp;The outer function would then be used perhaps thousands or millions of times to generate flightpaths of one or more ufos.&nbsp;</div><div><br></div><div><div>(define &nbsp;(((view-info earth) telescope) ufo)&nbsp;</div><div>&nbsp;&nbsp;(string-append "Geometric calcs of: " ufo ", " telescope ", " earth))</div><div><br></div><div>(((view-info "earth at 12:00") "big telescope") "green ufo at 12:01")&nbsp;</div><div>; a test, but not practical</div><div><br></div><div>(define &nbsp;use-earth-at-12:00 (view-info "earth at 12:00"))</div><div><br></div><div>(define &nbsp;view-from-starfire (use-earth-at-12:00 "starfire telescope"))</div><div>(define &nbsp;view-from-firepond (use-earth-at-12:00 "firepond telescope"))</div><div><br></div><div>(define &nbsp;ufos (list "green-ufo-at-12:01" "green-ufo-at-12:02" "red-ufo-at-12:01"))</div><div><br></div><div>(map view-from-starfire ufos) &nbsp;</div><div>(map view-from-firepond ufos)</div><div><br></div><div><br></div><div><div>Welcome to DrScheme, version 4.1 [3m].</div><div>Language: Module; memory limit: 128 megabytes.</div><div>"Geometric calcs of: green ufo at 12:01, big telescope, earth at 12:00"</div><div>("Geometric calcs of: green-ufo-at-12:01, starfire telescope, earth at 12:00"</div><div>&nbsp;"Geometric calcs of: green-ufo-at-12:02, starfire telescope, earth at 12:00"</div><div>&nbsp;"Geometric calcs of: red-ufo-at-12:01, starfire telescope, earth at 12:00")</div><div>("Geometric calcs of: green-ufo-at-12:01, firepond telescope, earth at 12:00"</div><div>&nbsp;"Geometric calcs of: green-ufo-at-12:02, firepond telescope, earth at 12:00"</div><div>&nbsp;"Geometric calcs of: red-ufo-at-12:01, firepond telescope, earth at 12:00")</div><div>>&nbsp;</div><div><br></div><div>rac</div></div></div></div><br><div> <div><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Courier" size="4" style="font: 14.0px Courier">"We ascribe beauty to that which is simple."</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Courier" size="4" style="font: 14.0px Courier">--Ralph Waldo Emerson</font></p> </div> </div><br></body></html>