{"id":469454,"date":"2025-08-03T21:00:25","date_gmt":"2025-08-03T21:00:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=469454"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=469454","title":{"rendered":"<span>GIMP Script-Fu \u041e\u041e\u041f. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0434\u0438\u0437\u0430\u0439\u043d (\u0430\u043b\u044f CLOS)<\/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>\u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f\u043c\u0438 \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 \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438(<strong>generic function<\/strong>) \u0438 \u043e\u043d\u0438 \u043f\u0440\u0438\u0434\u0430\u044e\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443, \u043f\u0440\u0438\u0434\u0430\u044e\u0442 \u0436\u0438\u0437\u043d\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c. \u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438? \u0414\u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0448\u0438\u0440\u043e\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0445(&#171;\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445&#187;) \u041e\u041e\u041f \u0441\u0438\u0441\u0442\u0435\u043c, \u043e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e \u0442\u0438\u043f\u0430\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u041e \u0432 CLOS \u044d\u0442\u043e \u041d\u0415 \u0422\u0410\u041a!!! \u0414\u0430 \u0432 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0442\u0430\u043a, \u041d\u041e..! CLOS \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 <strong>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u0434<\/strong> <strong>\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439<\/strong> \u043d\u0435 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434, \u0430 \u0446\u0435\u043b\u0443\u044e <strong>\u0433\u0440\u0443\u043f\u043f\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong>. \u041f\u0440\u0438\u0447\u0451\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u044d\u0442\u0430 \u0433\u0440\u0443\u043f\u043f\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0437\u043e\u0432\u0430, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \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(\u0432\u0435\u0440\u043d\u0435\u0435 \u0438\u0445 \u0442\u0438\u043f\u043e\u0432\/\u043a\u043b\u0430\u0441\u0441\u043e\u0432). \u0410 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0430\u043a\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043b\u0435\u0436\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 <code><strong><em>\u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/em><\/strong><\/code>.<\/p>\n<h2>\u041a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/h2>\n<p>CLOS \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 4 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432: <code>before<\/code>, <code>primary<\/code>,  <code>after<\/code> \u0438  <code>arorund<\/code>. \u042d\u0442\u0438 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043e\u0447\u0435\u0440\u0451\u0434\u043d\u043e\u0441\u0442\u044c \u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>\u041a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0420\u043e\u043b\u044c \u043c\u0435\u0442\u043e\u0434\u0430<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434(primary)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>:before<\/strong><\/p>\n<\/td>\n<td>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>:after<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>:around<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>\u041e\u0431\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0432\u043e\u043a\u0440\u0443\u0433 \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0438\u0434\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <strong>call-next-method<\/strong>(\u0432\u044b\u0437\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430) \u0432 <strong>around<\/strong>-\u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0438 \u0432 <strong>\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445<\/strong> \u043c\u0435\u0442\u043e\u0434\u0430\u0445.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0412\u0421\u0415 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <code>before<\/code>, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435.<br \/> \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0435\u0444\u0438\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434(\u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0438\u043c\u0435\u0442\u044c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438) <code>primary<\/code>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>call-next-method<\/code> \u0438 \u0442.\u0434 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435.<br \/> \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0412\u0421\u0415 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <code>after<\/code>, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0438\u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435(\u0441\u0430\u043c\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435), \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435.<\/p>\n<p>\u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code><strong>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong><\/code>.<\/p>\n<p>\u041d\u041e \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c <code>around<\/code> \u043c\u0435\u0442\u043e\u0434, \u0442\u043e \u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0435\u0435 \u0432\u0441\u0435\u0445. \u0418 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-next-method<\/code> \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 <code>around<\/code> \u043c\u0435\u0442\u043e\u0434 \u0418\u041b\u0418 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/code>(\u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c).<\/p>\n<p>\u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b <strong>\u043b\u0443\u0447\u0448\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434<\/strong>, <strong>\u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c<\/strong> \u0435\u0433\u043e <strong>\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong>, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \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<\/strong>. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0432\u0435\u0441\u0442\u0438 <strong>\u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b<\/strong> \u0438\u0445 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043d\u0430\u0441 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0449\u0443\u044e \u044d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e \u043d\u0435\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0438 \u0447\u0442\u043e \u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0435\u0451 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0438 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"lisp\">;;\u0432\u0432\u043e\u0434\u0438\u043c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (define-macro (def-keys . param-list)  ;;\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432    `(begin  ,@(make-def-keys param-list)))  (struct qualifier-methods (primary before after around))  (define (qm-get stru key)   (case key     (':primary (qualifier-methods-primary stru))     (':before  (qualifier-methods-before  stru))     (':after   (qualifier-methods-after   stru))     (':around  (qualifier-methods-around  stru))     ))  (define (qm-set! stru key val)   (case key     (':primary (qualifier-methods-primary! stru val))     (':before  (qualifier-methods-before!  stru val))     (':after   (qualifier-methods-after!   stru val))     (':around  (qualifier-methods-around!  stru val))     ))   (def-keys :before :after :around :primary) (define-m (qualifier? s)   (or (eq? s :before)       (eq? s :after)       (eq? s :around)       (eq? s :primary))) <\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u043c\u0430\u043a\u0440\u043e\u0441 \u0434\u043b\u044f \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)   (let* (   ;;(required-params (trim-parameters params))  (params       (gensym))  (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-methods-all    (make-symbol name \"-get-methods-all\"))  (name-get-cache-methods  (make-symbol name \"-get-cache-methods\"))  ;;for debug  (func         (gensym))  (fnd-method   (gensym))  (qual         (gensym)))     `(begin        (define    ,name)        (define    ,name-modify)        (define    ,name-get-methods)        (define    ,name-get-methods-all)        (define    ,name-get-cache-methods)        (let ((*methods-cache* (make-hash 32))          (*methods*       (qualifier-methods! '() '() '() '())))  (set!  ,name (lambda-m ,params (let* ((,shablon-call (apply make-shablon-call-by-args ,params))        (,applicable-method (,name-get-methods ,shablon-call)))   (if (and (car ,applicable-method)    (has-run-method (cdr ,applicable-method)))       (begin      (apply call-methods (cdr ,applicable-method) ,params))       (error (join-to-str \"Can't find applicable method: \" ',name \", params: \") ,params \"\\n\"))) ))  (set! ,name-modify (lambda-m (,shablon-call ,func ,qual)                (when (&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 (qm-get *methods* ,qual) ,shablon-call)))    (if (cdr ,fnd-method)        (set-cdr! (car ,fnd-method) (cons ,func '()))        (qm-set! *methods* ,qual (cons (list ,shablon-call ,func) (qm-get *methods* ,qual)))))))  (set! ,name-get-methods         (lambda-m (,shablon-call)                (let ((,cache-method  (hash-ref *methods-cache* ,shablon-call)))       (if (car ,cache-method)       ,cache-method       (let ((,applicable-method (build-applicable-methods *methods* ,shablon-call)))           (if (has-run-method ,applicable-method)          (begin            (hash-set! *methods-cache* ,shablon-call ,applicable-method)            (cons #t ,applicable-method))            (cons #f '()))           )))))  (set! ,name-get-methods-all (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>\u0412 \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 \u043c\u044b \u0432\u043d\u0435\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 <code>,name-get-methods<\/code>. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043d\u0430 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043d\u0443\u0436\u043d\u0430, \u0442.\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0445\u0435\u0448\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>,name<\/code>(\u0432\u043c\u0435\u0441\u0442\u043e ,name \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438), \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0415\u0449\u0451 <strong>\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0442\u0430\u043b\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 qual &#8212; \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/strong>, \u0442\u0435\u043f\u0435\u0440\u044c <strong>\u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043a\u043d\u0446\u0438\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u043e \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c<\/strong>, \u0442.\u0435 \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u0430\u043c, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043e\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439.<\/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\">;;\u0431\u0443\u0434\u0435\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f primary-\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c. (define-macro (defmethod start . body)   (let* ((have-qual (qualifier? (car start)))      (name   (if have-qual (cadr start) (car start)))      (params (if have-qual (cddr start) (cdr start)))      (qual   (if have-qual (car start) :primary))      (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))      (chains-methods (gensym))      (tmp-cur        (gensym))      (in-primary     (gensym)))     `(begin        (when (not (defined? ',name)) ;;\u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c defgeneric        (defgeneric ,name))        (,name-modify ',shablon-call     ;;\u0442\u0435\u043b\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c call-next-method      ,(cond        ((eq? qual :primary)     `(lambda-m ,(cons chains-methods names-params)         (let* ((next-method-p (lambda () (not (null? (qm-get ,chains-methods :primary)))))            (call-next-method   (lambda ()                             (call-methods-rec ,chains-methods ,@names-params))))                ,@body))       )        ((eq? qual :around)      `(lambda-m ,(cons chains-methods names-params)          (let* ((next-method-p (lambda ()                        (or (not (null? (qm-get ,chains-methods :before)))                                                    (not (null? (qm-get ,chains-methods :after)))                                                    (not (null? (qm-get ,chains-methods :primary)))                        (not (null? (qm-get ,chains-methods :around))))))             (call-next-method   (lambda ()                            (call-methods-rec ,chains-methods ,@names-params))))                 ,@body)))        (#t        `(lambda-m ,names-params             ,@body)       ))      ,qual))     )) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041c\u0430\u043a\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0442\u0430\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0432 \u043d\u0451 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-next-method<\/code> \u0438 <code>next-method-p<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0432\u044b\u0437\u043e\u0432\u0443\u0442\u044c\u0441\u044f \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432 \u043a\u043e\u0434\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e \u0438\u0435\u0440\u0435\u0440\u0430\u0445\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430. \u041d\u043e \u0441\u0430\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>call-next-method<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-methods-rec<\/code> \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u0432\u0441\u0435\u0433\u043e \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u043f\u0440\u0435\u0434\u043a\u043e\u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c(\u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f). \u0410 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>filter-acceptable-methods<\/code> \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>find-applicable-method<\/code>, <code>find-extreme<\/code> \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438 \u0441\u0432\u043e\u044e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0442\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043b\u0430\u043d \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>build-applicable-methods<\/code>.<\/p>\n<pre><code class=\"lisp\">(define (build-applicable-methods methods shablon)   (let* ((shablon-parents (build-shablon-parents shablon))  (acceptable-methods-primary (build-acceptable-method-list (qualifier-methods-primary methods) shablon-parents))  (acceptable-methods-before  (build-acceptable-method-list (qualifier-methods-before  methods) shablon-parents))  (acceptable-methods-after   (build-acceptable-method-list (qualifier-methods-after   methods) shablon-parents))  (acceptable-methods-around  (build-acceptable-method-list (qualifier-methods-around  methods) shablon-parents))  (compare-func (make-compare-shablon-call shablon-parents))  (rez (qualifier-methods! '() '() '() '())))     (qualifier-methods-around!  rez (sort-c compare-func acceptable-methods-around))     (qualifier-methods-before!  rez (sort-c compare-func acceptable-methods-before))     (qualifier-methods-primary! rez (sort-c compare-func acceptable-methods-primary))     (qualifier-methods-after!   rez (reverse (sort-c compare-func acceptable-methods-after)))     rez))<\/code><\/pre>\n<p>\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>build-acceptable-method-list<\/code>(\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u043e \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c) \u0438  \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u0433\u0434\u0435 \u0438\u0441\u043a\u0430\u043b\u0441\u044f \u043e\u0434\u0438\u043d \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0451 \u0442\u043e\u0439 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>make-compare-shablon-call<\/code>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u044d\u0442\u043e \u0434\u043e\u043b\u0433\u043e \u0438 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u043f\u0440\u043e\u0449\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0443 \u0438 \u0437\u0430\u0431\u044b\u0442\u044c, \u041d\u041e \u044d\u0442\u043e \u043a\u0435\u0448\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438 \u0432 \u0438\u0434\u0435\u0430\u043b\u0435(\u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b) <strong>\u043e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">;;\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                      (if (and (null? cur-methods)                               (null? cur-parents))                          (cons (cons (reverse new-shablon) (cdr x) ) prev)                          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)   )  (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))           ((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>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<pre><code class=\"lisp\">(define (has-run-method qm)   (or (not (null? (qualifier-methods-around  qm)))       (not (null? (qualifier-methods-before  qm)))       (not (null? (qualifier-methods-primary qm)))       (not (null? (qualifier-methods-after   qm)))))   (define (call-methods methods . params)   (let* ((qm (qualifier-methods! (qualifier-methods-primary methods)                                  (qualifier-methods-before  methods)                                  (qualifier-methods-after   methods)                                  (qualifier-methods-around  methods))))     (apply call-methods-rec (cons qm params))))  ;;\u041b\u041e\u0413\u0418\u041a\u0410: \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 ;;\u0430 \u043e\u043d \u0443\u0436\u0435 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0432\u044b\u0437\u043e\u0432\u0435 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u043d\u043e ;; \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 ;; \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0412\u0421\u0415 \u043c\u0435\u0442\u043e\u0434\u044b \u0414\u041e, \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 ;; \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u041f\u0415\u0420\u0412\u0418\u0427\u041d\u042b\u0419, \u0435\u0441\u043b\u0438 \u0435\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u041f\u0415\u0420\u0412\u0418\u0427\u041d\u042b\u0415 ;; \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0435 \u0412\u0421\u0415 \u043c\u0435\u0442\u043e\u0434\u044b \u041f\u041e\u0421\u041b\u0415 (define-m (call-methods-rec qm . params)   (let ((rez  #f))     (if (not (null? (qualifier-methods-around qm))) ;; \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c around \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u043a\u043e\u043d\u0447\u0430\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 call-next-method         (let ((tmp-cur (qualifier-methods-around qm)))           (qualifier-methods-around! qm (cdr tmp-cur))           (set! rez (apply (cadr (car tmp-cur)) (cons qm params))))         (let ((tmp-cur (qualifier-methods-primary qm)))           (unless (null? (qualifier-methods-before qm))             (for-list (el (qualifier-methods-before qm))                       (apply (cadr el) params))             (qualifier-methods-before! qm '())) ;;\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0432\u0441\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 before, \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c.           (when (not (null? tmp-cur))             (qualifier-methods-primary! qm (cdr tmp-cur))             (set! rez (apply (cadr (car tmp-cur)) (cons qm params))))           (unless (null? (qualifier-methods-after qm))             (for-list (el (qualifier-methods-after qm))                       ;;(prn \"Call after: \" (cadr el) \"\\n\")                       (apply (cadr el) params))             (qualifier-methods-after! qm '())) ;;\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0432\u0441\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 after, \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c.           ))     rez)) <\/code><\/pre>\n<p>\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-methods<\/code> \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u044e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0442.\u043a \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0430 \u043e\u043d\u0430 \u0443 \u043d\u0430\u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0435\u0448\u0435, \u0438 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u043c\u0438. \u0418 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-methods-rec<\/code>. \u041e\u043d\u0430 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430 \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>call-next-method<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u0432 \u043d\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0447\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434.<\/p>\n<p><strong>\u0418 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0430 \u044d\u0442\u043e\u043c \u0412\u0421\u0401!! <\/strong>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c.<\/p>\n<h2>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/h2>\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 \"obj4.scm\")) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u043e\u0434 <strong>\u0438\u0437 \u043a\u043d\u0438\u0433\u0438 \u041f\u043e\u043b\u0430 \u0413\u0440\u044d\u043c\u0430<\/strong> &#171;ANSI Common Lisp&#187; \u0441\u0442\u0440.196. \u0412 \u043d\u0451\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 <code>after<\/code>, \u0438 <code>before<\/code>, \u0438 <code>around<\/code>.<\/p>\n<pre><code class=\"lisp\">(defclass speaker () ())  (defmethod (speak (s speaker) str)   (prn str))  (speak (make-speaker) \"I`m hungry\") ;;I`m hungry  (defclass intellectual (speaker) ())  (defmethod  (:before speak  (i intellectual) string)   (prn \"Perhaps \"))  (defmethod (:after speak  (i intellectual) string)   (prn \" in some sense\"))   (speak (make-speaker) \"I`m hungry\") ;;I`m hungry (speak (make-intellectual) \"I`m hungry\") ;;Perhaps I`m hungry in some sense  (defmethod (:before speak  (s speaker) string)   (prn \"I think \"))  (speak (make-speaker) \"I`m hungry\")      ;;I think I`m hungry (speak (make-intellectual) \"I`m hungry\") ;;Perhaps I think I`m hungry in some sense  (defclass courtier (speaker) ())  (defmethod (:around speak (c courtier) string)   (prn \"Does the King believe that \" string \"?\")   (if (eqv? read-val 'yes)       (if (next-method-p) (call-next-method))       (prn \"Indeed, it is a preposterous idea.\\n\"))   'bow)   ;;\u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 Script-fu \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432\u0432\u043e\u0434 \u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c \u0437\u0430\u043c\u0435\u043d\u044e \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438 (define read-val 'yes)  (speak (make-courtier) \"kings will last\") ;;Does the King believe that kings will last?I think kings will last bow  (define read-val 'no)  (speak (make-courtier) \"the world is round\") ;;Does the King believe that the world is round? Indeed, it is a preposterous idea. ;;bow<\/code><\/pre>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c \u0438\u0437 \u043b\u0438\u0441\u043f\u0430.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 90 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b CLOS, \u0434\u0430 \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043c\u0435\u0442\u0430\u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430, \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u043e\u0449\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430. \u041d\u0435\u0442 \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438(\u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432).<\/p>\n<p>\u041d\u043e \u043d\u0443\u0436\u043d\u0430 \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c? \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043f\u043e\u043b\u0435\u0439 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u043c\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0432 \u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0434\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u044b \u0438 \u044f \u0438\u0445 \u0432\u0432\u0435\u0434\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u0435\u0435, \u044d\u0442\u043e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e. \u0410 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u044f\u0432\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043d\u0438\u0433\u0434\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u043c \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 CLOS.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 \u041f\u043e\u043b\u0430 \u0413\u0440\u044d\u043c\u0430.<\/p>\n<pre><code class=\"lisp\">(defgeneric price (x)    (:method-combination +))  (defclass jacket () ()) (defclass trousers () ()) (defclass suit (jacket trousers) ())  (defmethod price + ((jk jacket)) 350) (defmethod price + ((tr trousers)) 200)  (price (make-instance \u2019suit)) &gt;550  ;; \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u044b ;;+ and append list max min nconc or progn<\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u0434\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u041a\u043e\u0441\u0442\u044e\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0436\u0430\u043a\u0435\u0442\u0430 \u0438 \u0431\u0440\u044e\u043a. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0446\u0435\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e.<\/p>\n<pre><code class=\"lisp\">(defgeneric price x)  (defclass priced () (price)) (defclass jacket (priced) ()) (defclass trousers (priced) ()) (defclass suit ()     (jacket trousers))  (defmethod (price (p priced)) (vfield p :price)) ;;(defmethod (price (jk jacket)) (vfield jk :price)) ;;(defmethod (price (tr trousers)) (vfield tr :price)) (defmethod (price (s suit))    (with-slots ((jacket trousers) s)      (+ (price jacket) (price trousers))))  (define (suit! jk tr)    (make-suit :jacket (make-jacket :price jk) :trousers (make-trousers :price tr)))  (price (suit! 350 200)) ;;550 <\/code><\/pre>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <code>suit<\/code> \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043b\u0438\u0441\u044c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u0435\u0439. \u041f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0446\u0435\u043d\u0443 \u0434\u043b\u044f \u043a\u043e\u0441\u0442\u044e\u043c\u0430. \u0422\u0430\u043a\u0436\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u043b\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0435\u0441\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u043d\u0438\u0431\u0443\u0434\u044c, \u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0443\u0441\u044c \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u044e \u0441\u0432\u043e\u0438 \u0432\u0437\u0433\u043b\u044f\u0434\u044b, \u0430 \u043f\u043e\u043a\u0430 \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442.<\/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\/933644\/\"> https:\/\/habr.com\/ru\/articles\/933644\/<\/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>\u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f\u043c\u0438 \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 \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438(<strong>generic function<\/strong>) \u0438 \u043e\u043d\u0438 \u043f\u0440\u0438\u0434\u0430\u044e\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443, \u043f\u0440\u0438\u0434\u0430\u044e\u0442 \u0436\u0438\u0437\u043d\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c. \u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438? \u0414\u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0448\u0438\u0440\u043e\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0445(&#171;\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445&#187;) \u041e\u041e\u041f \u0441\u0438\u0441\u0442\u0435\u043c, \u043e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e \u0442\u0438\u043f\u0430\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u041e \u0432 CLOS \u044d\u0442\u043e \u041d\u0415 \u0422\u0410\u041a!!! \u0414\u0430 \u0432 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0442\u0430\u043a, \u041d\u041e..! CLOS \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 <strong>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u0434<\/strong> <strong>\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439<\/strong> \u043d\u0435 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434, \u0430 \u0446\u0435\u043b\u0443\u044e <strong>\u0433\u0440\u0443\u043f\u043f\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong>. \u041f\u0440\u0438\u0447\u0451\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u044d\u0442\u0430 \u0433\u0440\u0443\u043f\u043f\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0437\u043e\u0432\u0430, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \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(\u0432\u0435\u0440\u043d\u0435\u0435 \u0438\u0445 \u0442\u0438\u043f\u043e\u0432\/\u043a\u043b\u0430\u0441\u0441\u043e\u0432). \u0410 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0430\u043a\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043b\u0435\u0436\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 <code><strong><em>\u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/em><\/strong><\/code>.<\/p>\n<h2>\u041a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/h2>\n<p>CLOS \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 4 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432: <code>before<\/code>, <code>primary<\/code>,  <code>after<\/code> \u0438  <code>arorund<\/code>. \u042d\u0442\u0438 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043e\u0447\u0435\u0440\u0451\u0434\u043d\u043e\u0441\u0442\u044c \u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>\u041a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0420\u043e\u043b\u044c \u043c\u0435\u0442\u043e\u0434\u0430<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434(primary)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>:before<\/strong><\/p>\n<\/td>\n<td>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>:after<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"351\" width=\"351\">\n<p align=\"left\"><strong>:around<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>\u041e\u0431\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0432\u043e\u043a\u0440\u0443\u0433 \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0438\u0434\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <strong>call-next-method<\/strong>(\u0432\u044b\u0437\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430) \u0432 <strong>around<\/strong>-\u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0438 \u0432 <strong>\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445<\/strong> \u043c\u0435\u0442\u043e\u0434\u0430\u0445.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0412\u0421\u0415 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <code>before<\/code>, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435.<br \/> \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0435\u0444\u0438\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434(\u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0438\u043c\u0435\u0442\u044c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438) <code>primary<\/code>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>call-next-method<\/code> \u0438 \u0442.\u0434 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435.<br \/> \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0412\u0421\u0415 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <code>after<\/code>, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0438\u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435(\u0441\u0430\u043c\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435), \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435.<\/p>\n<p>\u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code><strong>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/strong><\/code>.<\/p>\n<p>\u041d\u041e \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c <code>around<\/code> \u043c\u0435\u0442\u043e\u0434, \u0442\u043e \u043e\u043d \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0435\u0435 \u0432\u0441\u0435\u0445. \u0418 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-next-method<\/code> \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 <code>around<\/code> \u043c\u0435\u0442\u043e\u0434 \u0418\u041b\u0418 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/code>(\u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c).<\/p>\n<p>\u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b <strong>\u043b\u0443\u0447\u0448\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434<\/strong>, <strong>\u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c<\/strong> \u0435\u0433\u043e <strong>\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong>, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \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<\/strong>. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0432\u0435\u0441\u0442\u0438 <strong>\u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b<\/strong> \u0438\u0445 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043d\u0430\u0441 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0449\u0443\u044e \u044d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e \u043d\u0435\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0438 \u0447\u0442\u043e \u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0435\u0451 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0438 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"lisp\">;;\u0432\u0432\u043e\u0434\u0438\u043c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (define-macro (def-keys . param-list)  ;;\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432    `(begin  ,@(make-def-keys param-list)))  (struct qualifier-methods (primary before after around))  (define (qm-get stru key)   (case key     (':primary (qualifier-methods-primary stru))     (':before  (qualifier-methods-before  stru))     (':after   (qualifier-methods-after   stru))     (':around  (qualifier-methods-around  stru))     ))  (define (qm-set! stru key val)   (case key     (':primary (qualifier-methods-primary! stru val))     (':before  (qualifier-methods-before!  stru val))     (':after   (qualifier-methods-after!   stru val))     (':around  (qualifier-methods-around!  stru val))     ))   (def-keys :before :after :around :primary) (define-m (qualifier? s)   (or (eq? s :before)       (eq? s :after)       (eq? s :around)       (eq? s :primary))) <\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u043c\u0430\u043a\u0440\u043e\u0441 \u0434\u043b\u044f \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)   (let* (   ;;(required-params (trim-parameters params))  (params       (gensym))  (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-methods-all    (make-symbol name \"-get-methods-all\"))  (name-get-cache-methods  (make-symbol name \"-get-cache-methods\"))  ;;for debug  (func         (gensym))  (fnd-method   (gensym))  (qual         (gensym)))     `(begin        (define    ,name)        (define    ,name-modify)        (define    ,name-get-methods)        (define    ,name-get-methods-all)        (define    ,name-get-cache-methods)        (let ((*methods-cache* (make-hash 32))          (*methods*       (qualifier-methods! '() '() '() '())))  (set!  ,name (lambda-m ,params (let* ((,shablon-call (apply make-shablon-call-by-args ,params))        (,applicable-method (,name-get-methods ,shablon-call)))   (if (and (car ,applicable-method)    (has-run-method (cdr ,applicable-method)))       (begin      (apply call-methods (cdr ,applicable-method) ,params))       (error (join-to-str \"Can't find applicable method: \" ',name \", params: \") ,params \"\\n\"))) ))  (set! ,name-modify (lambda-m (,shablon-call ,func ,qual)                (when (&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 (qm-get *methods* ,qual) ,shablon-call)))    (if (cdr ,fnd-method)        (set-cdr! (car ,fnd-method) (cons ,func '()))        (qm-set! *methods* ,qual (cons (list ,shablon-call ,func) (qm-get *methods* ,qual)))))))  (set! ,name-get-methods         (lambda-m (,shablon-call)                (let ((,cache-method  (hash-ref *methods-cache* ,shablon-call)))       (if (car ,cache-method)       ,cache-method       (let ((,applicable-method (build-applicable-methods *methods* ,shablon-call)))           (if (has-run-method ,applicable-method)          (begin            (hash-set! *methods-cache* ,shablon-call ,applicable-method)            (cons #t ,applicable-method))            (cons #f '()))           )))))  (set! ,name-get-methods-all (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>\u0412 \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 \u043c\u044b \u0432\u043d\u0435\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 <code>,name-get-methods<\/code>. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043d\u0430 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043d\u0443\u0436\u043d\u0430, \u0442.\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0445\u0435\u0448\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>,name<\/code>(\u0432\u043c\u0435\u0441\u0442\u043e ,name \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438), \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0415\u0449\u0451 <strong>\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0442\u0430\u043b\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 qual &#8212; \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/strong>, \u0442\u0435\u043f\u0435\u0440\u044c <strong>\u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043a\u043d\u0446\u0438\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u043e \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c<\/strong>, \u0442.\u0435 \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u0430\u043c, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043e\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439.<\/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\">;;\u0431\u0443\u0434\u0435\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f primary-\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c. (define-macro (defmethod start . body)   (let* ((have-qual (qualifier? (car start)))      (name   (if have-qual (cadr start) (car start)))      (params (if have-qual (cddr start) (cdr start)))      (qual   (if have-qual (car start) :primary))      (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))      (chains-methods (gensym))      (tmp-cur        (gensym))      (in-primary     (gensym)))     `(begin        (when (not (defined? ',name)) ;;\u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c defgeneric        (defgeneric ,name))        (,name-modify ',shablon-call     ;;\u0442\u0435\u043b\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c call-next-method      ,(cond        ((eq? qual :primary)     `(lambda-m ,(cons chains-methods names-params)         (let* ((next-method-p (lambda () (not (null? (qm-get ,chains-methods :primary)))))            (call-next-method   (lambda ()                             (call-methods-rec ,chains-methods ,@names-params))))                ,@body))       )        ((eq? qual :around)      `(lambda-m ,(cons chains-methods names-params)          (let* ((next-method-p (lambda ()                        (or (not (null? (qm-get ,chains-methods :before)))                                                    (not (null? (qm-get ,chains-methods :after)))                                                    (not (null? (qm-get ,chains-methods :primary)))                        (not (null? (qm-get ,chains-methods :around))))))             (call-next-method   (lambda ()                            (call-methods-rec ,chains-methods ,@names-params))))                 ,@body)))        (#t        `(lambda-m ,names-params             ,@body)       ))      ,qual))     )) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041c\u0430\u043a\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0442\u0430\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0432 \u043d\u0451 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-next-method<\/code> \u0438 <code>next-method-p<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0432\u044b\u0437\u043e\u0432\u0443\u0442\u044c\u0441\u044f \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432 \u043a\u043e\u0434\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043a\u0430\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e \u0438\u0435\u0440\u0435\u0440\u0430\u0445\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430. \u041d\u043e \u0441\u0430\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>call-next-method<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>call-methods-rec<\/code> \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u0432\u0441\u0435\u0433\u043e \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u043f\u0440\u0435\u0434\u043a\u043e\u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c(\u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f). \u0410 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>filter-acceptable-methods<\/code> \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>find-applicable-method<\/code>, <code>find-extreme<\/code> \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438 \u0441\u0432\u043e\u044e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0442\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043b\u0430\u043d \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>build-applicable-methods<\/code>.<\/p>\n<pre><code class=\"lisp\">(define (build-applicable-methods methods shablon)   (let* ((shablon-parents (build-shablon-parents shablon))  (acceptable-methods-primary (build-acceptable-method-list (qualifier-methods-primary methods)<\/code><\/pre>\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-469454","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/469454","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=469454"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/469454\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=469454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=469454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=469454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}