What task is best done in a functional programming style?

前端 未结 16 1824
-上瘾入骨i
-上瘾入骨i 2020-11-29 17:29

I\'ve just recently discovered the functional programming style and I\'m convinced that it will reduce development efforts, make code easier to read, make software more main

16条回答
  •  旧时难觅i
    2020-11-29 17:56

    The best advocacy paper ever written for the functional style is a paper by John Hughes called Why Functional Programming Matters. I suggest you do some examples for yourself until you reach the stage where you can convincingly make the arguments laid out in that paper.

    Many of the examples in the paper are numerical and do not resonate with today's audiences. One more contemporary exercise I gave my students was to use the ideas in that paper to pack large media files onto 4.7GB DVDs for backup. They used Michael Mitzenmacher's "bubble search" algorithm to generate alternative packings, and using this algorithm and Hughes's techniques it was easy to get each DVD (except the last) 99.9% full. Very sweet.

提交回复
热议问题