{"id":469406,"date":"2025-08-02T21:00:17","date_gmt":"2025-08-02T21:00:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=469406"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=469406","title":{"rendered":"<span>GIMP Script-Fu \u041e\u041e\u041f. \u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/gitflic.ru\/project\/nuinu\/gimp-script-fu-ext\" rel=\"noopener noreferrer nofollow\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043a Script-fu<\/a><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0413\u043e\u0442\u043e\u0432\u044f \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, \u0447\u0442\u043e \u0442\u0430\u043c \u0437\u0430 &#171;\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438&#187;? \u0412\u0441\u0435 \u044f\u0437\u044b\u043a\u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u0441\u043a\u0430\u0436\u0443 \u043e\u0434\u043d\u043e: Generic function \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u041b\u0418\u0421\u041f\u0435 \u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u044b\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u041d\u0415\u0411\u041e \u0438 \u0417\u0415\u041c\u041b\u042f. \u0417\u0430 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0440\u0430\u0442\u0443\u044e\u0442 \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438, \u0432\u0441\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0443\u0447\u0443 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043b\u0443\u043f\u043e. \u041d\u0435 \u0441\u043a\u0430\u0436\u0443 \u0442\u043e\u0447\u043d\u043e, \u043a\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0443 \u0438\u0441\u0442\u043e\u043a\u043e\u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 &#171;\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432&#187;, \u043d\u043e \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0430\u043d\u043d\u0438\u0445 \u0438\u0445 \u043f\u0440\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u044d\u0442\u043e \u0428\u0410\u0411\u041b\u041e\u041d\u042b \u0432 \u0421++. \u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u0442\u0438\u043f\u0430 \u044f\u0432\u044b \u0438 \u0435\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445, \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. (\u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u044f\u0437\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b\u0438 \u043a\u0430\u043a \u0432 \u043b\u0438\u0441\u043f\u0435, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430). \u041d\u043e \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u0432 \u041f\u041e\u0414\u041e\u0411\u041d\u042b\u0425 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u0445 \u044f\u0437\u044b\u043a\u0438 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>list<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043b\u044e\u0431\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0428\u0410\u0411\u041b\u041e\u041d\u042b \u043d\u0435 \u043d\u0443\u0436\u043d\u044b! \u0410 \u0432 \u0421++ \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0441\u0442\u0430\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043e\u0431\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u043b\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432, \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0421\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c (void *) \u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443, \u0442\u043e \u0421++ \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u043d\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e &#171;\u043f\u043e\u0442\u043e\u043b\u0441\u0442\u0435\u0432&#187; \u0432 \u043a\u043e\u0434\u0435. \u041d\u0443 \u0430 \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043c \u0443 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0435\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439?<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a, \u0438\u0437 Go<\/p>\n<pre><code class=\"go\">import \"golang.org\/x\/exp\/constraints\"  func GMin[T constraints.Ordered](x, y T) T {     if x &lt; y {         return x     }     return y }<\/code><\/pre>\n<p>\u041f\u044b\u0442\u0430\u044f\u0441\u044c \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u0438\u043f\u0430, \u0432\u0432\u043e\u0434\u044f\u0442 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e T, \u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044f \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0441 \u043d\u0435\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0442\u043e \u0435\u0451 \u0422\u0418\u041f\u0418\u0417\u0418\u0420\u041e\u0412\u0410\u0422\u042c!!! \u0412\u0432\u043e\u0434\u044f\u0442 \u041a\u041e\u041d\u0422\u0420\u0410\u041a\u0422! \u0410 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435? \u041d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043a \u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0430\u0434\u0434\u0438\u0442\u0438\u0432\u0435? \u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435? \u0438\u043b\u0438 \u0435\u0449\u0451 \u0447\u0442\u043e \u0442\u043e? \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0411\u0415\u0414\u0415\u041d! \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0441\u0438\u043b\u0443 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u0442\u044c \u043d\u0430\u043c \u0432 \u0442\u0438\u043f\u0435 \u0422. \u042f \u0432\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0436\u0443 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong>\u041d\u0410\u0421\u0422\u041e\u042f\u0429\u0418\u0415 \u0414\u0416\u0415\u041d\u0415\u0420\u0418\u041a\u0418<\/strong>.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438(\u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438) \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b.<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u043e \u043f\u043e\u043a\u0430 \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b &#171;\u043c\u0435\u0440\u0442\u0432\u044b&#187;, \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439. \u0427\u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u0438\u043c &#171;\u0436\u0438\u0437\u043d\u044c&#187;? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u044d\u0442\u043e \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438(<strong>GENERIC FUNCTION<\/strong>). \u0427\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435? <strong>\u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0435 \u0441\u0432\u043e\u0451 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 \u043d\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/strong>. \u041d\u043e \u043a\u0430\u043a \u043e\u043d\u0438 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442? \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>\u041c\u0415\u0422\u041e\u0414\u041e\u0412<\/strong>!<\/p>\n<p>\u041d\u0443 \u0447\u0442\u043e \u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>plus<\/code>.<\/p>\n<pre><code class=\"lisp\">(defgeneric plus x y)   ;;&lt;-------- \u0432\u043e\u0442 \u041e\u041d\u041e!!! \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0414\u0416\u0415\u041d\u0415\u0420\u0418\u041a\u0410!!!!  (defmethod (plus (x integer) (y integer))   ;; \u0430 \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.     (+ x y))  (defmethod (plus (x string) (y string))     (string-append x y))  (plus 1 2) ;; 3  (plus \"Hello \" \"world!\") ;; \"Hello world!\"<\/code><\/pre>\n<p>\u0412 &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445&#187; \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u0433\u0434\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u043a\u043b\u0430\u0441\u0441\u0430\u043c, \u0432\u044b\u0437\u043e\u0432 \u043a\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0440\u0430\u0441\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442 \u043a\u0430\u043a &#171;\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0443&#187;.<\/p>\n<pre><code class=\"cpp\">a.message(arg1 arg2);<\/code><\/pre>\n<p>\u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0441 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u044d\u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u044d\u0442\u043e <strong>\u0441\u0438\u0433\u043d\u0430\u043b \u0432\u0441\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c<\/strong>, \u0442.\u043a \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043e\u0442 \u043a\u043e\u0433\u043e \u0438 \u043a\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0438\u0433\u043d\u0430\u043b. \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u044d\u0442\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"lisp\">(defgeneric mul x y)  (defmethod (mul (x scalar) (y vector))     ....)  (defmethod (mul (x scalar) (y matrix))     ....)  (defmethod (mul (x vector) (y matrix))     ....)  (defmethod (mul (x matrix) (y vector))     ....)  (defmethod (mul (x matrix) (y matrix))     ....)  (mul (scalar! 23) (vector! 1 2 3))  (mul (vector! 1 2 3) (make-matrix-by-list '((1 2 3) (4 5 6)))<\/code><\/pre>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432,<strong> \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0441 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439<\/strong>(\u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0439\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432).<\/p>\n<p>\u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418 \u0434\u043b\u044f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b. \u041d\u043e \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u0430. \u0442\u0435. \u043e\u043d\u0438 \u0442\u0435\u0440\u044f\u044e\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0432\u043e\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0412 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u043e \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0430\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432,  \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u0443\u0436\u0435 \u0438\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043d\u0443 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440(\u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e) \u0434\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<em>(\u0432 \u043e\u0434\u043d\u043e\u0438 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u041e\u041e\u041f \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c)<\/em><\/p>\n<p>\u0418 \u0445\u043e\u0442\u044f, \u043a\u0430\u043a \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0437\u0430\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 &#171;\u0436\u0438\u0437\u043d\u0438&#187; \u043e\u0447\u0435\u043d\u044c \u043d\u0443\u0436\u043d\u044b <strong>\u043e\u0431\u043e\u0431\u0449\u0451\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong>. \u0418 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 <strong>\u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/strong> \u0432 tinyscheme, \u0430 \u0432\u0435\u0440\u043d\u0435\u0435 \u0432 <strong>script-fu GIMP<\/strong>.<\/p>\n<h2>\u041c\u0430\u043a\u0440\u043e\u0441 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/h2>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b \u043c\u043d\u0435 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<pre><code class=\"lisp\">(defgeneric test-gen1 a b c d)<\/code><\/pre>\n<p>\u0433\u0434\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u0430\u043a\u0440\u043e\u0441\u0430 \u044d\u0442\u043e \u0438\u043c\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438. (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u044d\u0442\u043e \u0438\u0437\u043b\u0438\u0448\u043d\u0435\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0441\u043e\u0437\u0434\u0430\u0432 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438)<\/p>\n<p>\u041c\u0430\u043a\u0440\u043e\u0441 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442:<\/p>\n<details class=\"spoiler\">\n<summary>\u043c\u0430\u043a\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(define-macro (defgeneric name . params)   (let* (   ;;(required-params (trim-parameters params))          (shablon-call (gensym))          (cache-method (gensym))          (applicable-method (gensym))          (name-modify  (make-symbol name \"-modify-method\"))          (name-get-methods        (make-symbol name \"-get-methods\"))        ;;for debug          (name-get-cache-methods  (make-symbol name \"-get-cache-methods\"))  ;;for debug          (func         (gensym))          (fnd-method   (gensym)))     `(begin        (define    ,name)        (define    ,name-modify)        (define    ,name-get-methods)        (define    ,name-get-cache-methods)        (let ((*methods-cache* (make-hash 32))              (*methods*      '()))      (set!  ,name (lambda-m ,params             (let* ((,shablon-call (make-shablon-call-by-args ,@params))                    (,cache-method  (hash-ref *methods-cache* ,shablon-call)))               (if (car ,cache-method)                   (begin                 ;;(prn \"call cached method\" (cadr ,cache-method))                 ((caddr ,cache-method) ,@params))                   (let ((,applicable-method (find-applicable-method *methods* ,shablon-call)))                 (if ,applicable-method    ;;(((a1 . 0) (a2 . 0) :unspec) \"method (a1 a2 :unspec)\")                     (begin                       (hash-set! *methods-cache* ,shablon-call ,applicable-method)                       ;;(prn \"call method shablon: \" (car  ,applicable-method) \"\\n\")                       ((cadr ,applicable-method) ,@params))                     (error \"Can't find applicable method: \" ,name \", params: \" ,@params))))               )))      (set! ,name-modify (lambda-m (,shablon-call ,func)                   (if (&gt; (hash-table-size *methods-cache*) 0)                   (set! *methods-cache* (make-hash 32))) ;;\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u043c \u043a\u0435\u0448 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.                   (let ((,fnd-method (find-method *methods* ,shablon-call)))                 (if (cdr ,fnd-method)                     (set-cdr! (car ,fnd-method) (cons ,func '()))                     (set! *methods* (cons (list ,shablon-call ,func) *methods*))))))      (set! ,name-get-methods (lambda ()                    *methods*))      (set! ,name-get-cache-methods (lambda ()                      *methods-cache*))        ))))  (define (find-method methods shablon)   (find (lambda (x)   (equal? shablon (car x))) methods)) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0432 \u043c\u0430\u043a\u0440\u043e\u0441\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0449\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u0434\u0430\u043d\u044b \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043e\u0431\u0449\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439: <code><em>methods-cache<\/em><\/code> \u0445\u0435\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 <code><em>methods<\/em><\/code> \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u0435\u0440\u0432\u0430\u044f <code>,name<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044d\u0442\u043e \u0441\u0430\u043c\u0430 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0435\u0451 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u0442\u0430, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0439 \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u0431\u043e\u0440\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434. \u0412\u0442\u043e\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>,name-modify<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0418 \u0435\u0449\u0451 \u0434\u0432\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: <code>,name-get-methods<\/code> \u0438 <code>,name-get-cache-methods<\/code>.<\/p>\n<p>\u041c\u0430\u043a\u0440\u043e\u0441 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0443\u043a\u0446\u0438\u044e <code>,name-modify<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 c \u0435\u0451 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434. \u0428\u0430\u0431\u043b\u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0442\u0438\u043f\u0430\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>\u043c\u0430\u043a\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(define-macro (defmethod start . body)   (let* ((name   (car start))      (params (cdr start))      (names-params (map (lambda (x) (if (list? x)                         (car x)                         x))                 params))      (name-modify  (make-symbol name \"-modify-method\"))      (shablon-call (make-shablon-call-by-params params)))     `(,name-modify ',shablon-call (lambda-m ,names-params ,@body))     ))  ;;\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (define (make-shablon-call-by-params  params)   (let ((rez '()))     (do ((cur params (cdr cur)))         ((null? cur) (reverse rez))       (set! rez (cons (if (list?    (car cur))                           (cadr     (car cur))                           :unspec) rez))))) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0433\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0439, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0430(\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0438\u043f\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>make-shablon-call-by-args<\/code>, \u0437\u0430\u0442\u0435\u043c \u043b\u0438\u0431\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u0445\u0435\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u044b <code><em>methods-cache<\/em><\/code>, \u043b\u0438\u0431\u043e \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0442, \u0438\u0449\u0435\u0442 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<details class=\"spoiler\">\n<summary>`find-applicable-method`<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(def-key :unspec)  ;;\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (define (make-shablon-call-by-args . args)   (let ((rez '()))     (do ((cur args (cdr cur)))     ((null? cur) (reverse rez))       (set! rez (cons (if (object?  (car cur))               (type-obj (car cur))               :unspec) rez)))))   (define (find-applicable-method methods shablon)   (let* ((shablon-parents (build-shablon-parents shablon))          (acceptable-method-list (build-acceptable-method-list methods shablon-parents))          (compare-func (make-compare-shablon-call shablon-parents))          (best (if (null? acceptable-method-list)                    #f                    (find-extreme compare-func                        acceptable-method-list)) ))     best)) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u0438\u0442 \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0430, \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u043a\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0430 (<code>build-shablon-parents<\/code>), \u0442.\u043a \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0440\u0435\u0434\u043a\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0418 \u0443\u0436\u0435 \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0435\u043c\u0443 \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u043a\u043e\u0432 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b (<code>build-acceptable-method-list<\/code>)<\/p>\n<details class=\"spoiler\">\n<summary>build-acceptable-method-list \u0438 \u0441\u043f\u0438\u0441\u043a\u0438 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">;;\u0432\u044b\u0434\u0430\u0435\u0451\u0442 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0441 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438 \u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. ;;\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0432\u044b\u0434\u0430\u0435\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b  ;; \u044f \u0431\u0443\u0434\u0443 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u043a\u0435\u0448\u0435 (\u0445\u0435\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u0435), \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438. (define *cache-class-precedence-list* #f)  ;;\u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043c\u0430\u043a\u0440\u043e\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u0431\u0440\u043e\u0441\u0430 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0445\u0435\u0448\u0430.  (define-macro (defclass . param)      ....    (let ((name      (car  param))          ....)      (let* ((parents-all (get-class-parents-all name))         ...)   ....      `(begin     (set! *cache-class-precedence-list* #f) ;;\u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u0435\u0448 cpl     ,valid ,@getters ,@setters ,maker)  )))  ;;\u0432 \u043a\u0435\u0448\u0435 cpl \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0434\u0432\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 car \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a cpl, \u0430 cdr \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0437 cpl \u0441 \u0443\u0440\u043e\u0432\u043d\u0435\u043c, \u043a\u0430\u043a \u0438\u0437 get-class-parents-ordered (define-m (get-class-precedence-list-all class)   (when (not *cache-class-precedence-list*)     (set! *cache-class-precedence-list* (make-hash 128)))   (let ((find-cpl (hash-ref *cache-class-precedence-list* class)))     (if (car find-cpl) (cdr find-cpl) (let* ((calc-cpl (compute-class-precedence-list class))        (ind      -1) ;;\u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 0        (ord-cpl  (map (lambda (x) (set! ind (+ ind 1)) (cons x ind)) calc-cpl)))   (hash-set! *cache-class-precedence-list* class (cons calc-cpl ord-cpl))   (cons calc-cpl ord-cpl)))))  (define-m (get-class-precedence-list class)   (car (get-class-precedence-list-all class)))  (define-m (get-class-precedence-list-with-level class)   (cdr (get-class-precedence-list-all class)))  (define get-class-parents-ordered  get-class-precedence-list-with-level)   ;;\u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 \u0432\u044b\u0437\u043e\u0432\u0430, \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c!!!!! (define (build-shablon-parents shablon)   (let ((rez   '()))     (for-list (cur shablon)       (if (eq? cur :unspec)   (push rez :unspec)   (push rez  (let  ((t1 (get-class-parents-ordered cur)))        (if t1    t1    '())))))     (reverse rez)))       ;;\u0441\u0442\u0440\u043e\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0442.\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043f\u0440\u0438\u043d\u0438\u043f\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043f\u043e\u0434 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. (define-m (build-acceptable-method-list methods shablon-parents)   (fold      (lambda (prev x)       (let ((shablon-methods (car x))             (exclude-method   #f)             (new-shablon     '()))         (do ((cur-methods shablon-methods (cdr cur-methods))              (cur-parents shablon-parents (cdr cur-parents)))             ((or exclude-method                  (null? cur-methods)                  (null? cur-parents))              (if exclude-method ;;\u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u043b\u044f\u043c\u0431\u0434\u044b                  prev           ;;\u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a                  (if (and (null? cur-methods)                           (null? cur-parents)) ;;\u0441\u0440\u0430\u0432\u043d\u0438\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u043d\u0435 \u043d\u0430\u0448\u043b\u0438, \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442!!!                      (cons (cons (reverse new-shablon) (cdr x) ) prev) ;;\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434                      prev)))           (if (eq? (car cur-methods) :unspec)  ;;\u0442\u0435\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441!!               (set! new-shablon  (cons :unspec new-shablon))               (if (eq? (car cur-parents) :unspec)  ;;\u0442\u0435\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0430                   (set! exclude-method #t)        ;;\u0442\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442!                   (let ((find-in-parents   (find (lambda (v) (eq? (car v) (car cur-methods)))                                                  (car cur-parents))))                      (if (cdr find-in-parents)    ;;\u0447\u0442\u043e \u0442\u043e \u043d\u0430\u0448\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u043a\u0430\u0445 \u043a\u043b\u0430\u0441\u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u0430                          (set! new-shablon  (cons (car find-in-parents) new-shablon))                          (set! exclude-method #t)))))))) ;;\u0442\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442      '()       methods)) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0430 \u0437\u0430\u0442\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>make-compare-shablon-call<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0435\u0434\u043a\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0449\u0443\u044e \u0448\u0430\u0431\u043b\u043e\u043d \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>;make-compare-shablon-call<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(define-m (make-compare-shablon-call shablon-parents)   (lambda (cur-best pretendent)     (let ((pretendent-the-best #f)       (current-the-best    #f))       (do ((f           (car cur-best)        (cdr f))            (s           (car pretendent)      (cdr s))            (cur-shablon shablon-parents       (cdr cur-shablon)))           ((or current-the-best                pretendent-the-best                (null? f)                (null? s))            (if pretendent-the-best                #f                #t))         (cond    ((and               (eq? (car s) :unspec)               (eq? (car f) :unspec))            #f)           ((eq? (car s) (car f))            #f)           ((eq? (car s) :unspec)            (set! current-the-best #t)            (prn \"(car s)  unspec \\n\"))           ((eq? (car s) :unspec)            (set! current-the-best #t))           ((eq? (car f) :unspec)            (set! pretendent-the-best #t))           ((&gt; (cdr (car s)) (cdr (car f)))            (set! current-the-best #t))           ((&lt; (cdr (car s)) (cdr (car f)))            (set! pretendent-the-best #t))           (#t ;;= (cdr (car s)) (cdr (car f)) \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u043f\u043e \u0443\u0440\u043e\u0432\u043d\u044e,            (let ((first (find (lambda (x) (or (eq? (car x) (car (car f))) (eq? (car x) (car (car s)))))                               (car cur-shablon))))              (when (cdr first)                  (if (eq? (car (car first)) (car (car s))) ;;\u043a\u0430\u0441\u0441 \u043f\u0435\u0440\u0435\u0442\u0435\u043d\u0434\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f?                      (set! pretendent-the-best #t)                      (set! current-the-best    #t)))          )))     )))) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0439 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0415\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#171; \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"lisp\">((define-m (find-extreme compare  lst)   (fold (lambda (a b)           (if (compare a b) a b))          (car lst) (cdr lst)))<\/code><\/pre>\n<p>\u0418 \u0432 \u043e\u0431\u0449\u0435\u043c \u0442\u043e \u043d\u0430 \u044d\u0442\u043e \u0412\u0421\u0401!!! \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e, \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b.<\/h2>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435, \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0434\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 Script-fu GIMP \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">;;(define path-home \"D:\") (define path-home (getenv \"HOME\")) (define path-lib (string-append path-home \"\/work\/gimp\/lib\/\")) (define path-work (string-append path-home \"\/work\/gimp\/\")) (load (string-append path-lib \"util.scm\")) (load (string-append path-lib \"defun.scm\")) (load (string-append path-lib \"struct2.scm\")) (load (string-append path-lib \"storage.scm\")) (load (string-append path-lib \"cyclic.scm\")) (load (string-append path-lib \"hashtable3.scm\")) ;;\u0445\u0435\u0448 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0435\u0439!!! (load (string-append path-lib \"sort2.scm\")) (load (string-append path-lib \"tsort.scm\")) (load (string-append path-lib \"cpl-sbcl.scm\"))  ;;\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u0438\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. ;;(load (string-append path-lib \"cpl-mro.scm\")) ;;(load (string-append path-lib \"cpl-topext.scm\")) (load (string-append path-lib \"struct2ext.scm\")) (load (string-append path-lib \"queue.scm\")) (load (string-append path-lib \"obj3.scm\"))<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>\u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(defclass a1 ()   ( fa1-1)) (defclass b1 ()   ((fb1-1 1)    (fb1-2 2)    (fb1-3 3))) (defclass a2 (a1)   ((fa2-1 'a)    (fa2-2 2)     fa2-3)) (defclass a3 (a1 b1)   (fa3-1)) (defclass a4 (a2 a3)   ((fa4-1 4)    (fa4-2 5))) (defclass a5 (a4 b1)   ()) (defclass b2 (b1)   ((fb2-1 4))) (defclass b3 (b2)   ((fb3-1 5))) (defclass b4 (a4 a3 b3)   ((fb4-1 6) fb4-2 (fb4-3 7)))<\/code><\/pre>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/69f\/cea\/b30\/69fceab306de096945b1ba208eb07ab5.png\" alt=\"&quot;gr07&quot;\" width=\"443\" height=\"304\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/69f\/cea\/b30\/69fceab306de096945b1ba208eb07ab5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/69f\/cea\/b30\/69fceab306de096945b1ba208eb07ab5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>&#171;gr07&#187;<\/figcaption><\/div>\n<\/figure>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0435\u0451 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<pre><code class=\"lisp\">(defgeneric prn-obj o)  (defmethod (prn-obj (o a1))   (prn \"Obj type:\" (type-obj o) \"\\n\")   (prn \"fields:\\n\" \"fa1-1: \" (vfield o :fa1-1) \"\\n\"))<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<pre><code class=\"lisp\">(define o1 (make-a1)) (define o11 (make-a1 :fa1-1 22))  (define o41 (make-a4 :fa1-1 42 :fa2-1 'b :fa2-3 43 :fa3-1 4)) (define o42 (make-a4 :fa1-1 51 :fa2-3 54 :fa3-1 55))  ;;\u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (for-list (o (list o1 o11 o41 o42))    (prn-obj o))<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">;; Obj type:a1 ;; fields: ;; fa1-1: #f ;; Obj type:a1 ;; fields: ;; fa1-1: 22 ;; Obj type:a4 ;; fields: ;; fa1-1: 42 ;; Obj type:a4 ;; fields: ;; fa1-1: 51<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"lisp\">(defmethod (prn-obj (o a2))   (prn \"Obj type:\" (type-obj o) \"\\n\")   (prn \"fields:\\n\" \"fa1-1: \" (vfield o :fa1-1) \", fa2-1: \" (vfield o :fa2-1) \", fa2-2: \" (vfield o :fa2-2) \", fa2-3: \" (vfield o :fa2-3) \"\\n\"))  (define o31 (make-a3 :fa1-1 42 :fa3-1 45)) (define o43 (make-a4 :fa1-1 42 :fa2-1 'b :fa2-3 43 :fa3-1 4 :fa4-1 'fa4val \"fa4-2 13\" ))  (defmethod (prn-obj (o a4))   (prn \"Obj type:\" (type-obj o) \"\\n\")   (prn \"fields:\\n\" \"fa1-1: \" (vfield o :fa1-1) \", fa2-1: \" (vfield o :fa2-1)         \", fa2-2: \"  (vfield o :fa2-2) \", fa2-3: \" (vfield o :fa2-3)  \", fa3-1: \" (vfield o :fa3-1)         \", fa4-1: \" (vfield o :fa4-1) \", fa4-2: \" (vfield o :fa4-2) \"\\n\"))  (for-list (o (list o1 o11 o41 o42 o31 o43))    (prn-obj o))<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">Obj type:a1          &lt;---\u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 a1 fields: fa1-1: #f Obj type:a1          &lt;---\u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 a1 fields: fa1-1: 22 Obj type:a4          &lt;---\u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 a4 fields: fa1-1: 42, fa2-1: b, fa2-2: 2, fa2-3: 43, fa3-1: 4, fa4-1: 4, fa4-2: 5 Obj type:a4          &lt;---\u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 a4 fields: fa1-1: 51, fa2-1: a, fa2-2: 2, fa2-3: 54, fa3-1: 55, fa4-1: 4, fa4-2: 5 Obj type:a3          &lt;---\u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 a2 fields: fa1-1: 42 Obj type:a4          &lt;---\u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 a4 fields: fa1-1: 42, fa2-1: b, fa2-2: 2, fa2-3: 43, fa3-1: 4, fa4-1: fa4val, fa4-2: 5 <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u043c \u043f\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043a \u043a\u043b\u0430\u0441\u0441\u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u0410 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0442\u0438\u043f\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d?<\/p>\n<pre><code class=\"lisp\">;;\u0432\u044b\u0437\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0434\u043b\u044f \u0442\u0438\u043f\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430. (define b11 (make-b1 :fb1-1 21 :fb1-3 23))  (prn-obj b11) ;;Error: Can't find applicable method:  #&lt;CLOSURE&gt; \", params: \" #(b1 23 2 21)<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0434\u0432\u0443\u043c\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0441\u043b\u0435\u0433\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0435\u0440\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b:<\/p>\n<details class=\"spoiler\">\n<summary>\u043d\u043e\u0432\u0430\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u0431\u0449\u0438\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(defclass named ()   (name)) (defclass a1 (named)   ( fa1-1)) (defclass b1 (named)   ((fb1-1 1)    (fb1-2 2)    (fb1-3 3))) (defclass a2 (a1)   ((fa2-1 'a)    (fa2-2 2)     fa2-3)) (defclass a3 (a1 b1)   (fa3-1)) (defclass a4 (a2 a3)   ((fa4-1 4)    (fa4-2 5))) (defclass a5 (a4 b1)   ()) (defclass b2 (b1)   ((fb2-1 4))) (defclass b3 (b2)   ((fb3-1 5))) (defclass b4 (a4 a3 b3)   ((fb4-1 6) fb4-2 (fb4-3 7)))  ;;\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b (define o1  (make-a1)) (define o11 (make-a1 :fa1-1 22)) (define o41 (make-a4 :fa1-1 42 :fa2-1 'b :fa2-3 43 :fa3-1 4)) (define o42 (make-a4 :fa1-1 51 :fa2-3 54 :fa3-1 55)) (define o31 (make-a3 :fa1-1 42 :fa3-1 45)) (define o43 (make-a4 :fa1-1 42 :fa2-1 'b :fa2-3 43 :fa3-1 4 :fa4-1 'fa4val \"fa4-2 13\" )) (define b11 (make-b1 :fb1-1 21 :fb1-3 23)) (define b41 (make-b4 :fb1-1 21 :fb1-3 23))  ;;\u043d\u0443\u0436\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u043a\u0440\u043e\u0445\u0430\u043a. (define-macro (named-obj obj)   `(vfield! (eval ,obj) :name ,obj))  (for-list (o `(o1 o11 o41 o42 o31 o43 b11 b41))   (named-obj o)) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0434\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"lisp\">(defgeneric message x y)  ;; \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0441\u0430\u043c\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. (defmethod (message (x named) (y named))   (prn \"message from x: \" (vfield x :name) \" to y: \" (vfield y :name) \"\\n\"))  (message o1 o43) ;;message from x: o1 to y: o43<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0451 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/p>\n<pre><code class=\"lisp\">(defmethod (message (x a4) (y b1))   (prn \"message from x: \" (vfield x :name) \" to y: \" (vfield y :name) \"\\n\")   (prn \"x:\\n\")   (prn-obj x)   (prn \"y:\\n\")   (prn-obj y))   (defmethod (message (x named) (y b1))   (prn \"message from x: \" (vfield x :name) \" to y: \" (vfield y :name) \"\\n\")   (prn \"y:\\n\")   (prn-obj y))  (defmethod (prn-obj (o named))   (prn \"Obj type:\" (type-obj o) \"\\n\")   (prn \"fields:\\n\" \"name: \" (vfield o :name) \"\\n\")) <\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0432\u0443\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(message o31 b41) ;; message (x named) (y b1) from x: o31 to y: b41 ;; y: ;; Obj type:b4 ;; fields: ;; fa1-1: #f, fa2-1: a, fa2-2: 2, fa2-3: #f  (message o41 b11) ;; message (x a4) (y b1) from x: o41 to y: b11 ;; x: ;; Obj type:a4 ;; fields: ;; fa1-1: 42, fa2-1: b, fa2-2: 2, fa2-3: 43 ;; y: ;; Obj type:b1 ;; fields: ;; name: b11  (message o41 b41) ;; message (x a4) (y b1) from x: o41 to y: b41 ;; x: ;; Obj type:a4 ;; fields: ;; fa1-1: 42, fa2-1: b, fa2-2: 2, fa2-3: 43 ;; y: ;; Obj type:b4   ;;&lt;---\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 prn-obj \u0434\u043b\u044f \u0442\u0438\u043f\u0430 a4, \u0430 \u043e\u043d \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c b1 ;; fields: ;; fa1-1: #f, fa2-1: a, fa2-2: 2, fa2-3: #f <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 b1, \u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0432 \u043d\u0435\u0433\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0434\u0430\u043b\u0451\u043a\u043e\u0433\u043e \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u0430 b4, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043f\u043e\u0442\u043e\u043c\u043e\u043a a4 \u0438 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043a \u043d\u0435\u043c\u0443 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e prn-obj, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 a4. \u041d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0445 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u0438\u043f\u0430\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0441\u0451 \u0437\u0430\u043a\u043e\u043d\u043d\u043e.<\/p>\n<p>\u0418 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0430\u0448 \u043a\u0435\u0448 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/p>\n<pre><code class=\"lisp\">(hash2pairs *cache-class-precedence-list*) ;; ((b4 (b4 a4 a2 a3 a1 b3 b2 b1 named) ;;      (b4 . 0) (a4 . 1) (a2 . 2) (a3 . 3) (a1 . 4) (b3 . 5) (b2 . 6) (b1 . 7) (named . 8)) ;;  (a4 (a4 a2 a3 a1 b1 named) (a4 . 0) (a2 . 1) (a3 . 2) (a1 . 3) (b1 . 4) (named . 5)) ;;  (a3 (a3 a1 b1 named) (a3 . 0) (a1 . 1) (b1 . 2) (named . 3)) ;;  (b1 (b1 named) (b1 . 0) (named . 1)) ;;  (a1 (a1 named) (a1 . 0) (named . 1))) <\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/h2>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0446\u044e\u0449\u0438\u0445 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u0438\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u044d\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 CLOS(\u044d\u0442\u043e \u0447\u0442\u043e \u0442\u043e<strong> \u0431\u043b\u0438\u0437\u043a\u043e\u0435 \u043a GOOPS-guile \u041e\u041e\u041f<\/strong>), \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d <strong>\u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043f\u043e\u0441\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 <strong>\u0442\u0438\u043f\u043e\u0432(\u043a\u043b\u0430\u0441\u0441\u043e\u0432) \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong>. \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u0434\u0443\u043c\u0430\u044e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u041b\u0418\u0421\u041f \u0438\u043d\u0442\u0435\u0440\u0435\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0428\u0410\u0411\u041b\u041e\u041d\u041d\u042b\u0425 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0430 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, <strong>\u041e\u0411\u041e\u0411\u0429\u0401\u041d\u041d\u0410\u042f \u0424\u0423\u041d\u041a\u0426\u0418\u042f \u041b\u0418\u0421\u041f<\/strong> \u0438\u043c\u0435\u0435\u0442 <strong>\u041c\u041d\u041e\u0416\u0415\u0421\u0422\u0412\u041e \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0445 \u0435\u0451 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u042f\u041f \u0438\u043c\u0435\u044e\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e &#8212; \u0448\u0430\u0431\u043b\u043e\u043d.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/933466\/\"> https:\/\/habr.com\/ru\/articles\/933466\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/gitflic.ru\/project\/nuinu\/gimp-script-fu-ext\" rel=\"noopener noreferrer nofollow\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043a Script-fu<\/a><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0413\u043e\u0442\u043e\u0432\u044f \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, \u0447\u0442\u043e \u0442\u0430\u043c \u0437\u0430 &#171;\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438&#187;? \u0412\u0441\u0435 \u044f\u0437\u044b\u043a\u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u0441\u043a\u0430\u0436\u0443 \u043e\u0434\u043d\u043e: Generic function \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u041b\u0418\u0421\u041f\u0435 \u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u044b\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u041d\u0415\u0411\u041e \u0438 \u0417\u0415\u041c\u041b\u042f. \u0417\u0430 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0440\u0430\u0442\u0443\u044e\u0442 \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438, \u0432\u0441\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0443\u0447\u0443 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043b\u0443\u043f\u043e. \u041d\u0435 \u0441\u043a\u0430\u0436\u0443 \u0442\u043e\u0447\u043d\u043e, \u043a\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0443 \u0438\u0441\u0442\u043e\u043a\u043e\u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 &#171;\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432&#187;, \u043d\u043e \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0430\u043d\u043d\u0438\u0445 \u0438\u0445 \u043f\u0440\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u044d\u0442\u043e \u0428\u0410\u0411\u041b\u041e\u041d\u042b \u0432 \u0421++. \u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u0442\u0438\u043f\u0430 \u044f\u0432\u044b \u0438 \u0435\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445, \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. (\u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u044f\u0437\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b\u0438 \u043a\u0430\u043a \u0432 \u043b\u0438\u0441\u043f\u0435, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430). \u041d\u043e \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u0432 \u041f\u041e\u0414\u041e\u0411\u041d\u042b\u0425 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u0445 \u044f\u0437\u044b\u043a\u0438 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>list<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043b\u044e\u0431\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0428\u0410\u0411\u041b\u041e\u041d\u042b \u043d\u0435 \u043d\u0443\u0436\u043d\u044b! \u0410 \u0432 \u0421++ \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0441\u0442\u0430\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043e\u0431\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u043b\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432, \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0421\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c (void *) \u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443, \u0442\u043e \u0421++ \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u043d\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e &#171;\u043f\u043e\u0442\u043e\u043b\u0441\u0442\u0435\u0432&#187; \u0432 \u043a\u043e\u0434\u0435. \u041d\u0443 \u0430 \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043c \u0443 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0435\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439?<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a, \u0438\u0437 Go<\/p>\n<pre><code class=\"go\">import \"golang.org\/x\/exp\/constraints\"  func GMin[T constraints.Ordered](x, y T) T {     if x &lt; y {         return x     }     return y }<\/code><\/pre>\n<p>\u041f\u044b\u0442\u0430\u044f\u0441\u044c \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u0438\u043f\u0430, \u0432\u0432\u043e\u0434\u044f\u0442 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e T, \u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044f \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0441 \u043d\u0435\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0442\u043e \u0435\u0451 \u0422\u0418\u041f\u0418\u0417\u0418\u0420\u041e\u0412\u0410\u0422\u042c!!! \u0412\u0432\u043e\u0434\u044f\u0442 \u041a\u041e\u041d\u0422\u0420\u0410\u041a\u0422! \u0410 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435? \u041d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043a \u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0430\u0434\u0434\u0438\u0442\u0438\u0432\u0435? \u0430 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435? \u0438\u043b\u0438 \u0435\u0449\u0451 \u0447\u0442\u043e \u0442\u043e? \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0411\u0415\u0414\u0415\u041d! \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0441\u0438\u043b\u0443 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u0442\u044c \u043d\u0430\u043c \u0432 \u0442\u0438\u043f\u0435 \u0422. \u042f \u0432\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0436\u0443 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong>\u041d\u0410\u0421\u0422\u041e\u042f\u0429\u0418\u0415 \u0414\u0416\u0415\u041d\u0415\u0420\u0418\u041a\u0418<\/strong>.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438(\u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438) \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b.<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u043e \u043f\u043e\u043a\u0430 \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b &#171;\u043c\u0435\u0440\u0442\u0432\u044b&#187;, \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439. \u0427\u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u0438\u043c &#171;\u0436\u0438\u0437\u043d\u044c&#187;? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u044d\u0442\u043e \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438(<strong>GENERIC FUNCTION<\/strong>). \u0427\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435? <strong>\u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0435 \u0441\u0432\u043e\u0451 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 \u043d\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/strong>. \u041d\u043e \u043a\u0430\u043a \u043e\u043d\u0438 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442? \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>\u041c\u0415\u0422\u041e\u0414\u041e\u0412<\/strong>!<\/p>\n<p>\u041d\u0443 \u0447\u0442\u043e \u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>plus<\/code>.<\/p>\n<pre><code class=\"lisp\">(defgeneric plus x y)   ;;&lt;-------- \u0432\u043e\u0442 \u041e\u041d\u041e!!! \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0414\u0416\u0415\u041d\u0415\u0420\u0418\u041a\u0410!!!!  (defmethod (plus (x integer) (y integer))   ;; \u0430 \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.     (+ x y))  (defmethod (plus (x string) (y string))     (string-append x y))  (plus 1 2) ;; 3  (plus \"Hello \" \"world!\") ;; \"Hello world!\"<\/code><\/pre>\n<p>\u0412 &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445&#187; \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u0433\u0434\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u043a\u043b\u0430\u0441\u0441\u0430\u043c, \u0432\u044b\u0437\u043e\u0432 \u043a\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0440\u0430\u0441\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442 \u043a\u0430\u043a &#171;\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0443&#187;.<\/p>\n<pre><code class=\"cpp\">a.message(arg1 arg2);<\/code><\/pre>\n<p>\u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0441 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u044d\u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u044d\u0442\u043e <strong>\u0441\u0438\u0433\u043d\u0430\u043b \u0432\u0441\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c<\/strong>, \u0442.\u043a \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043e\u0442 \u043a\u043e\u0433\u043e \u0438 \u043a\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0438\u0433\u043d\u0430\u043b. \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u044d\u0442\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"lisp\">(defgeneric mul x y)  (defmethod (mul (x scalar) (y vector))     ....)  (defmethod (mul (x scalar) (y matrix))     ....)  (defmethod (mul (x vector) (y matrix))     ....)  (defmethod (mul (x matrix) (y vector))     ....)  (defmethod (mul (x matrix) (y matrix))     ....)  (mul (scalar! 23) (vector! 1 2 3))  (mul (vector! 1 2 3) (make-matrix-by-list '((1 2 3) (4 5 6)))<\/code><\/pre>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432,<strong> \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0441 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439<\/strong>(\u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0439\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432).<\/p>\n<p>\u041e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418 \u0434\u043b\u044f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b. \u041d\u043e \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u0430. \u0442\u0435. \u043e\u043d\u0438 \u0442\u0435\u0440\u044f\u044e\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0432\u043e\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0412 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u043e \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0430\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432,  \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u0443\u0436\u0435 \u0438\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043d\u0443 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440(\u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e) \u0434\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<em>(\u0432 \u043e\u0434\u043d\u043e\u0438 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 \u041e\u041e\u041f \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c)<\/em><\/p>\n<p>\u0418 \u0445\u043e\u0442\u044f, \u043a\u0430\u043a \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0437\u0430\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 &#171;\u0436\u0438\u0437\u043d\u0438&#187; \u043e\u0447\u0435\u043d\u044c \u043d\u0443\u0436\u043d\u044b <strong>\u043e\u0431\u043e\u0431\u0449\u0451\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong>. \u0418 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 <strong>\u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/strong> \u0432 tinyscheme, \u0430 \u0432\u0435\u0440\u043d\u0435\u0435 \u0432 <strong>script-fu GIMP<\/strong>.<\/p>\n<h2>\u041c\u0430\u043a\u0440\u043e\u0441 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/h2>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b \u043c\u043d\u0435 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<pre><code class=\"lisp\">(defgeneric test-gen1 a b c d)<\/code><\/pre>\n<p>\u0433\u0434\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u0430\u043a\u0440\u043e\u0441\u0430 \u044d\u0442\u043e \u0438\u043c\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438. (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u044d\u0442\u043e \u0438\u0437\u043b\u0438\u0448\u043d\u0435\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0441\u043e\u0437\u0434\u0430\u0432 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438)<\/p>\n<p>\u041c\u0430\u043a\u0440\u043e\u0441 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442:<\/p>\n<details class=\"spoiler\">\n<summary>\u043c\u0430\u043a\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(define-macro (defgeneric name . params)   (let* (   ;;(required-params (trim-parameters params))          (shablon-call (gensym))          (cache-method (gensym))          (applicable-method (gensym))          (name-modify  (make-symbol name \"-modify-method\"))          (name-get-methods        (make-symbol name \"-get-methods\"))        ;;for debug          (name-get-cache-methods  (make-symbol name \"-get-cache-methods\"))  ;;for debug          (func         (gensym))          (fnd-method   (gensym)))     `(begin        (define    ,name)        (define    ,name-modify)        (define    ,name-get-methods)        (define    ,name-get-cache-methods)        (let ((*methods-cache* (make-hash 32))              (*methods*      '()))      (set!  ,name (lambda-m ,params             (let* ((,shablon-call (make-shablon-call-by-args ,@params))                    (,cache-method  (hash-ref *methods-cache* ,shablon-call)))               (if (car ,cache-method)                   (begin                 ;;(prn \"call cached method\" (cadr ,cache-method))                 ((caddr ,cache-method) ,@params))                   (let ((,applicable-method (find-applicable-method *methods* ,shablon-call)))                 (if ,applicable-method    ;;(((a1 . 0) (a2 . 0) :unspec) \"method (a1 a2 :unspec)\")                     (begin                       (hash-set! *methods-cache* ,shablon-call ,applicable-method)                       ;;(prn \"call method shablon: \" (car  ,applicable-method) \"\\n\")                       ((cadr ,applicable-method) ,@params))                     (error \"Can't find applicable method: \" ,name \", params: \" ,@params))))               )))      (set! ,name-modify (lambda-m (,shablon-call ,func)                   (if (&gt; (hash-table-size *methods-cache*) 0)                   (set! *methods-cache* (make-hash 32))) ;;\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u043c \u043a\u0435\u0448 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.                   (let ((,fnd-method (find-method *methods* ,shablon-call)))                 (if (cdr ,fnd-method)                     (set-cdr! (car ,fnd-method) (cons ,func '()))                     (set! *methods* (cons (list ,shablon-call ,func) *methods*))))))      (set! ,name-get-methods (lambda ()                    *methods*))      (set! ,name-get-cache-methods (lambda ()                      *methods-cache*))        ))))  (define (find-method methods shablon)   (find (lambda (x)   (equal? shablon (car x))) methods)) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0432 \u043c\u0430\u043a\u0440\u043e\u0441\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0449\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u0434\u0430\u043d\u044b \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043e\u0431\u0449\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439: <code><em>methods-cache<\/em><\/code> \u0445\u0435\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 <code><em>methods<\/em><\/code> \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u0435\u0440\u0432\u0430\u044f <code>,name<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044d\u0442\u043e \u0441\u0430\u043c\u0430 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0435\u0451 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u0442\u0430, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0439 \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u0431\u043e\u0440\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434. \u0412\u0442\u043e\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>,name-modify<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0418 \u0435\u0449\u0451 \u0434\u0432\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: <code>,name-get-methods<\/code> \u0438 <code>,name-get-cache-methods<\/code>.<\/p>\n<p>\u041c\u0430\u043a\u0440\u043e\u0441 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0443\u043a\u0446\u0438\u044e <code>,name-modify<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 c \u0435\u0451 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434. \u0428\u0430\u0431\u043b\u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0442\u0438\u043f\u0430\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>\u043c\u0430\u043a\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(define-macro (defmethod start . body)   (let* ((name   (car start))      (params (cdr start))      (names-params (map (lambda (x) (if (list? x)                         (car x)                         x))                 params))      (name-modify  (make-symbol name \"-modify-method\"))      (shablon-call (make-shablon-call-by-params params)))     `(,name-modify ',shablon-call (lambda-m ,names-params ,@body))     ))  ;;\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (define (make-shablon-call-by-params  params)   (let ((rez '()))     (do ((cur params (cdr cur)))         ((null? cur) (reverse rez))       (set! rez (cons (if (list?    (car cur))                           (cadr     (car cur))                           :unspec) rez))))) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0433\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0439, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0430(\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0438\u043f\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>make-shablon-call-by-args<\/code>, \u0437\u0430\u0442\u0435\u043c \u043b\u0438\u0431\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u0445\u0435\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u044b <code><em>methods-cache<\/em><\/code>, \u043b\u0438\u0431\u043e \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0442, \u0438\u0449\u0435\u0442 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<details class=\"spoiler\">\n<summary>`find-applicable-method`<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(def-key :unspec)  ;;\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (define (make-shablon-call-by-args . args)<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-469406","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/469406","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=469406"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/469406\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=469406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=469406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=469406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}