{"id":155487,"date":"2012-12-04T03:02:03","date_gmt":"2012-12-03T23:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=155487"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=155487","title":{"rendered":"<span class=\"post_title\">\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0435: \u041f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       \u041d\u0438\u043b \u0424\u043e\u0440\u0434, \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u041f\u041e, ThoughWorks Inc.<br \/>  21 \u0430\u0432\u0433\u0443\u0441\u0442\u0430 2012<br \/>  \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/www.ibm.com\/developerworks\/java\/library\/j-ft15\/index.html\">Functional thinking: Rethinking dispatch<\/a><\/p>\n<p>  <a href=\"http:\/\/habrahabr.ru\/post\/155477\/\">\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a>, \u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Java \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432 \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u043a\u0430\u043a \u0432 Scala, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435, \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0438\u0441\u043a-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u0432 Scala \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043a\u0430\u043a \u0442\u0435\u0440\u043c\u0438\u043d \u0432 \u0448\u0438\u0440\u043e\u043a\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u044f\u0437\u044b\u043a\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u042d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 JVM \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Java.<\/p>\n<p>  (<i>\u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434.: dispatch method mechanism<\/i>, \u043f\u0435\u0440\u0435\u0432\u043e\u0434 <i>\u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/i> \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043f\u043e Java, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u0440\u043c\u0438\u043d \u043a\u0430\u043a <i>\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/i>, \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"http:\/\/habrahabr.ru\/qa\/26299\/\">\u043f\u0435\u0440\u0432\u044b\u0439<\/a>)<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0423\u043b\u0443\u0447\u0448\u0430\u0435\u043c \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Groovy<\/h4>\n<p>  \u0412 Java, \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f <i>if<\/i> \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u043b\u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 <i>switch<\/i>. \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u0438\u043d\u043d\u0443\u044e \u0441\u0435\u0440\u0438\u044e <i>if<\/i> \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0442\u044f\u0436\u0435\u043b\u043e \u0447\u0438\u0442\u0430\u0442\u044c, Java \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0411\u0430\u043d\u0434\u0443 \u0427\u0435\u0442\u044b\u0440\u0435\u0445 (Gang of Four, GoF) \u2014 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <i>Factory<\/i> \u0438\u043b\u0438 <i>Abstract Factory<\/i>. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0432\u044b\u0431\u043e\u0440\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434.<\/p>\n<p>  \u0412 Groovy \u0435\u0441\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0435 <i>switch<\/i> \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043d\u043e \u043d\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <i>switch<\/i> \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 Java, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 1:<\/p>\n<p>  <i>(\u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434.: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0445 \u043e\u0446\u0435\u043d\u043e\u043a \u0432 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0435, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432)<\/i><\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 1. \u0421\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u043e\u0435 Groovy switch \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/b>  <\/p>\n<pre><code class=\"java\">class LetterGrade {   def gradeFromScore(score) {     switch (score) {       case 90..100 : return &quot;A&quot;       case 80..&lt;90 : return &quot;B&quot;       case 70..&lt;80 : return &quot;C&quot;       case 60..&lt;70 : return &quot;D&quot;       case 0..&lt;60  : return &quot;F&quot;       case ~&quot;[ABCDFabcdf]&quot; : return score.toUpperCase()       default: throw new IllegalArgumentException(&quot;Invalid score: ${score}&quot;)     }   } } <\/code><\/pre>\n<p>  <i>Switch<\/i> \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 Groovy \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432. \u0412 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 1, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>score<\/i> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u0447\u0438\u0441\u043b\u043e\u043c \u043c\u0435\u0436\u0434\u0443 0 \u0438 100 \u043b\u0438\u0431\u043e \u0431\u0443\u043a\u0432\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438. \u041a\u0430\u043a \u0432 Java, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 <i>case<\/i> c \u043f\u043e\u043c\u043e\u0449\u044c\u044e <i>return<\/i> \u0438\u043b\u0438 <i>break<\/i>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0443 \u0436\u0435 \u00ab\u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443\u00bb (<i>fall-through semantics<\/i>). \u041d\u043e \u0432 Groovy, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 Java, \u044f \u043c\u043e\u0433\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b (90..100, \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b 80..&lt;90), \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f (~&quot;[ABCDFabcdf]&quot;), \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f Groovy \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0435 \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 2:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 2. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0445 \u043e\u0446\u0435\u043d\u043e\u043a \u043d\u0430 Groovy<\/b>  <\/p>\n<pre><code class=\"java\">@Test public void test_letter_grades() {   def lg = new LetterGrade()   assertEquals(&quot;A&quot;, lg.gradeFromScore(92))   assertEquals(&quot;B&quot;, lg.gradeFromScore(85))   assertEquals(&quot;D&quot;, lg.gradeFromScore(65))   assertEquals(&quot;F&quot;, lg.gradeFromScore(&quot;f&quot;)) }  <\/code><\/pre>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u0439 switch \u0434\u0430\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0437\u043e\u043b\u043e\u0442\u0443\u044e \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0438\u0435\u0439 if \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <i>Factory<\/i>. <i>Switch<\/i> \u0432 Groovy \u0434\u0430\u0435\u0442 \u0432\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0442\u0438\u043f\u044b, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u0432 Scala  <\/p>\n<hr\/>\n<p>  <\/p>\n<h4> \u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u0432 Scala<\/h4>\n<p>  \u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u0432 Scala \u0434\u0430\u0435\u0442 \u0432\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u043d\u0438\u0435, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 3:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 3. \u0411\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u0432 Scala<\/b>  <\/p>\n<pre><code class=\"scala\">val VALID_GRADES = Set(&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;, &quot;F&quot;)  def letterGrade(value: Any) : String = value match {   case x:Int if (90 to 100).contains(x) =&gt; &quot;A&quot;   case x:Int if (80 to 90).contains(x) =&gt; &quot;B&quot;   case x:Int if (70 to 80).contains(x) =&gt; &quot;C&quot;   case x:Int if (60 to 70).contains(x) =&gt; &quot;D&quot;   case x:Int if (0 to 60).contains(x) =&gt; &quot;F&quot;   case x:String if VALID_GRADES(x.toUpperCase) =&gt; x.toUpperCase } <\/code><\/pre>\n<p>  \u0412 Scala, \u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044f \u0442\u0438\u043f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043a\u0430\u043a <i>Any<\/i>. \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 <i>match<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 3, \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0445\u0440\u0430\u043d\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 (<i>guard condition)<\/i>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432 \u0446\u0435\u043b\u043e\u043c.<br \/>  \u041b\u0438\u0441\u0442\u0438\u043d\u0433 4 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0432\u044b\u0431\u043e\u0440\u0430 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 4. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0445 \u043e\u0446\u0435\u043d\u043e\u043a \u0432 Scala<\/b>  <\/p>\n<pre><code class=\"scala\">printf(&quot;Amy scores %d and receives %s\\n&quot;, 91, letterGrade(91)) printf(&quot;Bob scores %d and receives %s\\n&quot;, 72, letterGrade(72)) printf(&quot;Sam never showed for class, scored %d, and received %s\\n&quot;, 44, letterGrade(44)) printf(&quot;Roy transfered and already had %s, which translated as %s\\n&quot;,      &quot;B&quot;, letterGrade(&quot;B&quot;)) <\/code><\/pre>\n<p>  \u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u0432 Scala \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 <i>case \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438(case classes)<\/i> Scala, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h5>\u00ab\u0413\u0438\u0431\u043a\u0438\u0439\u00bb \u044f\u0437\u044b\u043a Clojure<\/h5>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0439 \u044f\u0437\u044b\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0431\u0430\u0437\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b Java \u044d\u0442\u043e Clojure. Clojure \u2014 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Lisp \u043d\u0430 \u0431\u0430\u0437\u0435 JVM \u2014 \u0438\u043c\u0435\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u0430\u0431\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043a \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443, \u043e\u043d \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0439\u043d\u0441\u0442\u0440\u0438\u043c Java \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u043a\u0430\u043a \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439. \u0415\u0433\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u044d\u0442\u043e <a href=\"http:\/\/en.wikipedia.org\/wiki\/Homoiconicity\">homoiconicity<\/a>, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435 \u0447\u0442\u043e \u044f\u0437\u044b\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0449\u0438\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u0434\u0440\u0443\u0433\u0438\u043c \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  Java \u0438 \u044f\u0437\u044b\u043a\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043d\u0430 \u043d\u0435\u0433\u043e \u0438\u043c\u0435\u044e\u0442 \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 (<i>keywords<\/i>) \u2014 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u044f\u0437\u044b\u043a\u0430. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0432 \u044f\u0437\u044b\u043a (\u0445\u043e\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 Java-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435), \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0438\u043c\u0435\u044e\u0442 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <i>if<\/i> \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432 Java \u00ab\u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u00bb \u0432\u0435\u0449\u0438 \u0442\u0438\u043f\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0431\u0443\u043b\u0435\u0430\u043d\u043e\u0432\u0441\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0412 Java \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043a\u043b\u0430\u0441\u0441\u044b, \u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f(\u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0447\u0438\u043c, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b). \u0412 Lisp-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0442\u0438\u043f\u0430 Clojure, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u043e\u0436\u0435\u0442 <i>\u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u044f\u0437\u044b\u043a \u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/i>, \u0440\u0430\u0437\u043c\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c \u044f\u0437\u044b\u043a\u0430 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u044f\u0437\u044b\u043a \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c. \u042f \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044e \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u0433\u043e\u043c\u043e\u0438\u043a\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438; \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u2014 \u044d\u0442\u043e \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044f \u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0437\u0430 Clojure (\u0438 Lisp-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438).<\/p>\n<p>  \u0412 Clojure, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044f\u0437\u044b\u043a \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 (Lisp) \u043a\u043e\u0434. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u041b\u0438\u0441\u0442\u0438\u043d\u0433 5 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0446\u0435\u043d\u043a\u0430\u043c\u0438 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0432 \u0432\u0438\u0434\u0435 Clojure \u043a\u043e\u0434\u0430:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 5. \u0411\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u043d\u0430 Clojure<\/b>  <\/p>\n<pre><code class=\"lisp\">(defn letter-grade [score]   (cond     (in score 90 100) &quot;A&quot;     (in score 80 90)  &quot;B&quot;     (in score 70 80)  &quot;C&quot;     (in score 60 70)  &quot;D&quot;     (in score 0 60)   &quot;F&quot;     (re-find #&quot;[ABCDFabcdf]&quot; score) (.toUpperCase score)))  (defn in [score low high]   (and (number? score) (&lt;= low score high))) <\/code><\/pre>\n<p>  \u0412 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 5, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u0435\u0442\u043e\u0434 <i>letter-grade <\/i>\u044f\u0441\u043d\u043e \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439, \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043c\u0435\u0442\u043e\u0434 <i>in<\/i> \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>cond<\/i> \u0434\u0430\u0435\u0442 \u043c\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0442\u0435\u0441\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437<i> in<\/i> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u044f \u043c\u043e\u0433\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0435 \u0442\u0430\u043a \u0438 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u0447\u0435\u0442\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0431\u0443\u043a\u0432\u0430 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e \u043c\u0435\u0442\u043e\u0434 <i>toUpperCase<\/i> \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 Clojure, \u043c\u0435\u0442\u043e\u0434\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0436\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (first-class citizens), \u0430 \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u00ab\u0438\u0437\u043d\u0443\u0442\u0440\u0438-\u043d\u0430\u0440\u0443\u0436\u0443\u00bb: \u0432\u044b\u0437\u043e\u0432 <i>score.toUpperCase()<\/i> \u0432 Java \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <i>(. toUpperCase score)<\/i>.<\/p>\n<p>  \u0422\u0435\u0441\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 6:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 6. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0445 \u043e\u0446\u0435\u043d\u043e\u043a \u043d\u0430 Clojure<\/b>  <\/p>\n<pre><code class=\"lisp\">(ns nealford-test   (:use clojure.test)   (:use lettergrades))   (deftest numeric-letter-grades   (dorun (map #(is (= &quot;A&quot; (letter-grade %))) (range 90 100)))   (dorun (map #(is (= &quot;B&quot; (letter-grade %))) (range 80 89)))   (dorun (map #(is (= &quot;C&quot; (letter-grade %))) (range 70 79)))   (dorun (map #(is (= &quot;D&quot; (letter-grade %))) (range 60 69)))   (dorun (map #(is (= &quot;F&quot; (letter-grade %))) (range 0 59))))  (deftest string-letter-grades   (dorun (map #(is (= (.toUpperCase %)            (letter-grade %))) [&quot;A&quot; &quot;B&quot; &quot;C&quot; &quot;D&quot; &quot;F&quot; &quot;a&quot; &quot;b&quot; &quot;c&quot; &quot;d&quot; &quot;f&quot;])))  (run-all-tests) <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438! \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u0434, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 Clojure.<\/p>\n<p>  \u0412 \u0442\u0435\u0441\u0442\u0435 <i>numeric-letter-grades<\/i>, \u044f \u0445\u043e\u0447\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0440\u0430\u043c\u043a\u0430\u0445. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435\u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 Lisp, \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u0434, \u044d\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0440\u0443\u0436\u0443. \u0421\u043d\u0430\u0447\u0430\u043b\u0430, \u043a\u043e\u0434 <i>#(is (= \u00abA\u00bb (letter-grade %))) <\/i> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440(\u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0432 \u0442\u0435\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e %) \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <i>true<\/i> \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0430 \u0432\u0435\u0440\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <i>map<\/i> \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0447\u0438\u0441\u0435\u043b \u0432 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, <i>map<\/i> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e). \u0424\u0443\u043d\u043a\u0446\u0438\u044f <i>dorun<\/i> \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 (side effects), \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0438\u0445. \u0412\u044b\u0437\u043e\u0432 <i>map<\/i> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <i>range<\/i> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a <i>true<\/i> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 (namespace) clojure.test \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442. \u0412\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 <i>dorun<\/i> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u0430.<\/p>\n<h4>\u041c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u044b \u0432 Clojure<\/h4>\n<p>  \u0414\u043b\u0438\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <i>if<\/i> \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u044f\u0436\u0435\u043b\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c, \u043f\u043e\u043a\u0430 Java \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u044f\u0437\u044b\u043a\u0430. \u042d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Factory \u0438\u043b\u0438 Abstract Factory \u0438\u0437 GoF(Gang of Four, \u0411\u0430\u043d\u0434\u0430 \u0447\u0435\u0442\u044b\u0440\u0435\u0445). \u0428\u0430\u0431\u043b\u043e\u043d Factory \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Java \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0443-\u043d\u0430-\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438-\u043a\u043b\u0430\u0441\u0441\u043e\u0432 (class-based polymorphism), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043c\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u043b\u0430\u0432\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0437\u0430\u0442\u0435\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f. <\/p>\n<h5>\u0424\u0430\u0431\u0440\u0438\u043a\u0438 \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c<\/h5>\n<p>  \u0412 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 Java \u0443 Groovy \u043c\u0435\u043d\u0435\u0435 \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u044b\u0439 (verbose) \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u043c\u0435\u0441\u0442\u043e Java \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 <i>Product<\/i> <i>(\u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434.: product \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0432\u0438\u0434\u0443 \u043a\u0430\u043a \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b, \u0445\u043e\u0442\u044f \u0441\u0430\u043c\u0430 \u0438\u0434\u0435\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0430 \u0434\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0438\u0434\u043e\u0432, \u043a\u0430\u043a \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0435, \u043f\u0440\u044f\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435, \u0442\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u044b\u0435)<\/i>, \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 7:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 7. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 Groovy <\/b>  <\/p>\n<pre><code class=\"java\">interface Product {   public int evaluate(int op1, int op2) }  class Multiply implements Product {   @Override   int evaluate(int op1, int op2) {     op1 * op2   } }  class Incrementation implements Product {   @Override   int evaluate(int op1, int op2) {     def sum = 0     op2.times {       sum += op1     }     sum   } }  class ProductFactory {   static Product getProduct(int maxNumber) {     if (maxNumber &gt; 10000)       return new Multiply()     else       return new Incrementation()   } } <\/code><\/pre>\n<p>  \u0412 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 7, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0412 <i>ProductFactory<\/i>, \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0444\u0430\u0431\u0440\u0438\u043a\u0438.<\/p>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043a\u0430\u043a \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0445\u0441\u044f \u043d\u0430 \u0431\u0430\u0437\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434 \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 8:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 8. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/b>  <\/p>\n<pre><code class=\"java\">@Test public void decisionTest() {   def p = ProductFactory.getProduct(10010)   assertTrue p.getClass() == Multiply.class   assertEquals(2*10010, p.evaluate(2, 10010))   p = ProductFactory.getProduct(9000)   assertTrue p.getClass() == Incrementation.class   assertEquals(3*3000, p.evaluate(3, 3000)) } <\/code><\/pre>\n<p>  \u0412 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 8, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <i>Product<\/i>, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0444\u0430\u0431\u0440\u0438\u043a\u0438.<\/p>\n<p>  \u0412 Java, \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438: \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u044d\u0442\u0430 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u043d\u0435\u0435 \u0442\u0435\u0441\u043d\u0430\u044f.<\/p>\n<h5>\u041f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u043f\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e \u0432 Clojure<\/h5>\n<p>  <i>(\u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434.: \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043c\u0438\u0440\u0435 Clojure \u044d\u0442\u043e\u0442 \u0432\u0438\u0434 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <u>a la carte polymorphism<\/u> \u0438 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 Clojure \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u043c \u044f\u0437\u044b\u043a\u0430 \u0420\u0438\u0447\u0435\u043c \u0425\u0438\u043a\u0438 \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 <a href=\"http:\/\/www.infoq.com\/presentations\/Simple-Made-Easy\">StrangeLoop<\/a>.)<\/i> <\/p>\n<p>  \u041c\u043d\u043e\u0433\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 Clojure \u0434\u0443\u043c\u0430\u044f, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c, \u0432\u0435\u0440\u044f \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u041e\u041e\u041f \u044f\u0437\u044b\u043a\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u044b\u0441\u043b\u0438. \u042d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430: Clojure \u0438\u043c\u0435\u0435\u0442 \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u041e\u041e\u041f \u044f\u0437\u044b\u043a\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Clojure \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c, \u043d\u043e \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0446\u0435\u043d\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. Clojure \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 <i>\u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u044b(multimethods)<\/i>, \u0433\u0434\u0435 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0435 (\u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e. <\/p>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440. \u0412 Clojure \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 <i>struct<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0442 \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 9:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 9. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 Clojure<\/b>  <\/p>\n<pre><code class=\"lisp\">(defstruct color :red :green :blue)  (defn red [v]   (struct color v 0 0))  (defn green [v]   (struct color 0 v 0))  (defn blue [v]   (struct color 0 0 v)) <\/code><\/pre>\n<p>  \u0412 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 9, \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 3 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0446\u0432\u0435\u0442\u043e\u0432. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u044e 3 \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u043e\u0434\u043d\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u043c.<\/p>\n<p>  \u041c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434 \u0432 Clojure \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430(<i>method defintion<\/i>), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u043e\u0442\u0431\u043e\u0440\u0430. \u041f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430. <\/p>\n<p>  \u041b\u0438\u0441\u0442\u0438\u043d\u0433 10 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 10. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u0430<\/b>  <\/p>\n<pre><code class=\"lisp\">(defn basic-colors-in [color]   (for [[k v] color :when (not= v 0)] k))  (defmulti color-string basic-colors-in)  (defmethod color-string [:red] [color]   (str &quot;Red: &quot; (:red color)))  (defmethod color-string [:green] [color]   (str &quot;Green: &quot; (:green color)))  (defmethod color-string [:blue] [color]   (str &quot;Blue: &quot; (:blue color)))  (defmethod color-string :default [color]   (str &quot;Red:&quot; (:red color) &quot;, Green: &quot; (:green color) &quot;, Blue: &quot; (:blue color))) <\/code><\/pre>\n<p>  \u0412 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 10, \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <i>basic-color-in<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u0441\u0435\u0445 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430, \u044f \u0443\u0442\u043e\u0447\u043d\u044f\u044e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0440\u043d\u0435\u0442 \u043e\u0434\u0438\u043d \u0446\u0432\u0435\u0442. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043e\u043d\u0430 \u0432\u0435\u0440\u043d\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u044d\u0442\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <i>:default<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u044f \u043f\u043e\u043b\u0443\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0446\u0432\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0441\u0435\u0445 \u0446\u0432\u0435\u0442\u043e\u0432.<\/p>\n<p>  \u0422\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044d\u0442\u0438\u0445 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 11:<\/p>\n<p>  <b>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 11. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u0432 Clojure.<\/b>  <\/p>\n<pre><code class=\"lisp\">(ns colors-test   (:use clojure.test)   (:use colors))  (deftest pure-colors   (is (= &quot;Red: 5&quot; (color-string (struct color 5 0 0))))   (is (= &quot;Green: 12&quot; (color-string (struct color 0 12 0))))   (is (= &quot;Blue: 40&quot; (color-string (struct color 0 0 40)))))  (deftest varied-colors   (is (= &quot;Red:5, Green: 40, Blue: 6&quot; (color-string (struct color 5 40 6))))) <\/code><\/pre>\n<p>  \u0412 \u041b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 11, \u043a\u043e\u0433\u0434\u0430 \u044f \u0432\u044b\u0437\u044b\u0432\u0430\u044e \u043c\u0435\u0442\u043e\u0434 \u0441 \u043e\u0434\u043d\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u043c, \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430. \u0415\u0441\u043b\u0438 \u044f \u0432\u044b\u0437\u043e\u0432\u0443 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c, \u043c\u0435\u0442\u043e\u0434 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0435\u0440\u043d\u0435\u0442 \u0432\u0441\u0435 \u0446\u0432\u0435\u0442\u0430.<\/p>\n<p>  \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0449\u043d\u0443\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, Clojure \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u043e\u0449\u043d\u0443\u044e \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u0443\u044e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c \u043a\u0430\u043a \u0438 \u0432 Java, \u043d\u043e \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u0412\u044b\u0432\u043e\u0434<\/h4>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u0435\u0433\u043b\u044b\u0439 \u043e\u0431\u0437\u043e\u0440 \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0432 \u044f\u0437\u044b\u043a\u0430\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f (next-generation languages) \u043d\u0430 \u0431\u0430\u0437\u0435 JVM. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u044f\u0437\u044b\u043a\u043e\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0434\u0435\u0442 \u043a \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0445\u043e\u0434\u043d\u044b\u043c \u043f\u0443\u0442\u044f\u043c \u0432 \u0432\u0438\u0434\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u044b\u0431\u043e\u0440 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u043c \u0438\u0437-\u0437\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u0437\u0433\u043b\u044f\u0434\u044b \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f.          \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/155487\/\"> http:\/\/habrahabr.ru\/post\/155487\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       \u041d\u0438\u043b \u0424\u043e\u0440\u0434, \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u041f\u041e, ThoughWorks Inc.<br \/>  21 \u0430\u0432\u0433\u0443\u0441\u0442\u0430 2012<br \/>  \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/www.ibm.com\/developerworks\/java\/library\/j-ft15\/index.html\">Functional thinking: Rethinking dispatch<\/a><\/p>\n<p>  <a href=\"http:\/\/habrahabr.ru\/post\/155477\/\">\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a>, \u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Java \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432 \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u043a\u0430\u043a \u0432 Scala, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435, \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0438\u0441\u043a-\u043f\u043e-\u043e\u0431\u0440\u0430\u0437\u0446\u0443 \u0432 Scala \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043a\u0430\u043a \u0442\u0435\u0440\u043c\u0438\u043d \u0432 \u0448\u0438\u0440\u043e\u043a\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u044f\u0437\u044b\u043a\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u042d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 JVM \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Java.<\/p>\n<p>  (<i>\u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434.: dispatch method mechanism<\/i>, \u043f\u0435\u0440\u0435\u0432\u043e\u0434 <i>\u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/i> \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043f\u043e Java, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u0440\u043c\u0438\u043d \u043a\u0430\u043a <i>\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/i>, \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"http:\/\/habrahabr.ru\/qa\/26299\/\">\u043f\u0435\u0440\u0432\u044b\u0439<\/a>)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-155487","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=155487"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155487\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}