{"id":469624,"date":"2025-08-05T15:00:05","date_gmt":"2025-08-05T15:00:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=469624"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=469624","title":{"rendered":"<span>GIMP Script-Fu \u041e\u041e\u041f. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u00ab\u0420\u041e\u041c\u0411\u0415 \u0421\u041c\u0415\u0420\u0422\u0418\u00bb<\/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>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430 \u041b\u0438\u0441\u043f \u044d\u0442\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u044f \u043d\u0435 \u0437\u043d\u0430\u044e(\u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e \u0438\u0445 \u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u044f \u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u044e) \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0446\u0438\u043a\u043b: \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434 &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430(\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435) \u0431\u044b\u043b \u0431\u044b \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c. \u041a\u0441\u0442\u0430\u0442\u0438 \u0432 Script-fu \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0447\u0435\u0440\u0435\u0437 \u0431\u0443\u0444\u0435\u0440 \u043e\u0431\u043c\u0435\u043d\u0430, \u044d\u0442\u043e \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e! \u0422\u0430\u043c \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u0415\u043c\u0430\u043a\u0441, \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0435\u0440 Scrip-fu, \u043d\u043e \u044f \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e(\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c), \u0430 \u0441 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0438\u043b\u0438 \u043b\u0438\u0441\u043f\u043e\u043c, \u0440\u0430\u0431\u043e\u0442\u0430 \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043a\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043f\u0430\u0440\u044b \u043a\u043b\u0430\u0432\u0438\u0448. \u041b\u0438\u0441\u043f\u0435\u0440\u044b \u043d\u0435 \u043f\u0438\u0448\u0443\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0438 \u043a\u043e\u0434\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0442, \u043e\u043d\u0438 \u043f\u0438\u0448\u0443\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0435\u0433\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0442. \u0412\u0441\u0451 \u044d\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 <strong>REPL<\/strong>. \u0418 \u0432\u0441\u0451 \u0442\u0430\u043a\u0438 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0430\u0451\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 <strong>\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b,<\/strong> \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 <strong>\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/strong>, \u0430 \u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0442\u043e \u043b\u0438\u0431\u043e \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0438 \u043a\u0430\u043a\u0430\u044f \u043d\u0438\u0431\u0443\u0434\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430 \u043e\u0442\u0432\u0430\u043b\u0438\u0442\u0441\u044f.<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435(\u0432 \u0441\u0432\u044f\u0437\u0438 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432) \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f <strong>\u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0435<\/strong> <strong>\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/strong> \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438, \u043f\u043e \u043c\u0438\u043c\u043e \u043d\u0438\u0445, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u043b\u044f\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0442.\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0442.\u0434. \u0422\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u0438 \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438,  \u0447\u0435\u043c \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438.<\/p>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u043e \u0441 \u0440\u0438\u0441\u043a\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0431\u043e \u043e\u0442\u043a\u0430\u0437\u0430, \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"lisp\">(define *test-rezult* '()) (define-m (push-rez x)   (push *test-rezult* x))  ;;\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. (define (test-func func args comp-func)   (set! *test-rezult* '())   (let ((rez (catch (begin  '())                (cons (apply func args) '()))))     (set! *test-rezult* (reverse (cons rez *test-rezult*))) (if (not (null? rez))         (if (apply comp-func (list *test-rezult*))             (cons #t *test-rezult*)             (cons #f *test-rezult*))     (cons rez *test-rezult*)))) <\/code><\/pre>\n<p>\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439: <strong>\u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442<\/strong> \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0433\u043e<strong> \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong> \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431 \u044d\u0442\u043e\u043c(\u043f\u0443\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430) \u0432\u044b\u0448\u0435\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/p>\n<details class=\"spoiler\">\n<summary>\u0442\u0435\u0441\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(define (t1 x1)   (\/ 10 x1))  (t1 10) ;;1 (t1 0) ;;Error: \/: division by zero   (test-func t1 '(2) (lambda (x) (if (not (null? (car x)))                                (begin (prn \"args: \" x \"\\n\") (= (caar x) 5))     #f))) ;;(#t (5))  \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 5 \u0438 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e  (test-func t1 '(2) (lambda (x) (if (not (null? (car x)))                                (begin (prn \"args: \" x \"\\n\") (= (caar x) 4))    #f))) ;;(#f (5)) \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 5 \u0438 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e(\u043c\u044b \u043e\u0436\u0438\u0434\u0430\u043b\u0438 4).  (test-func t1 '(0) (lambda (x) (if (not (null? (car x)))                                (begin (prn \"args: \" x \"\\n\") (= (caar x) 4))    #f))) ;;(() ())# \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043f\u0435\u0440\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u0434\u0448\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0435 <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u0448\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442 \u0442\u0440\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u0434\u0448\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u041f\u043e \u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043f\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u043c\u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u044f \u0432\u0432\u0451\u043b \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code><em>test-rezult<\/em><\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c <code>push-rez<\/code> \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0414\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0449\u0443\u044e \u043d\u0430\u043c \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"lisp\">(define-m (named-test name func args comp-func)   (let ((rez (test-func func args comp-func)))     (cond      ((null? (car rez))       (prn \"FAIL TEST! (executed error!) `\" name \"` rez: \" (cdr rez) \"\\n\")   (throw (join-to-str \"FAIL TEST! (executed error!) `\" name \"`\")))      ((car rez)       (prn \"PASS TEST!: `\" name \"` rez: \" (cdr rez) \"\\n\"))      ((not (car rez))       (prn \"FAIL TEST! (unexpected rezult) `\" name \"` rez: \" (cdr rez) \"\\n\")   (throw (join-to-str  \"FAIL TEST! (unexpected rezult) `\" name \"`\")))      (#t       (prn \"UNKNOWN TEST RESULT `\" name \"` args: \" args \", rez: \"  rez \"\\n\")))     ))   (define-macro (check-equal param)   (let ((var    (gensym)))     `(lambda (,var) (equal?  ,param ,var)))) <\/code><\/pre>\n<p>\u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c <strong>\u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/strong> \u043f\u0440\u0438 \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"lisp\">(define (test-t1 x)   (push-rez \"Start test\")   (let ((rez (t1 x)))     (push-rez \"End test\") rez))  (named-test \"test1 t1\" test-t1 '(5) (check-equal '(\"Start test\" \"End test\" (2)))) ;;PASS TEST!: `test1 t1` rez: (Start test End test (2))  (named-test \"test1 t1\" test-t1 '(0) (check-equal '(\"Start test\" \"End test\" (2)))) ;;FAIL TEST! (executed error!) `test1 t1` rez: (Start test ()) ;;Error: FAIL TEST! (executed error!) `test1 t1`   (named-test \"test1 t1\" test-t1 '(4) (check-equal '(\"Start test\" \"End test\" (2)))) ;;FAIL TEST! (unexpected rezult) `test1 t1` rez: (Start test End test (2,5.0)) ;;Error: FAIL TEST! (unexpected rezult) `test1 t1`  <\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h2>\u041a\u043b\u0430\u0441\u0441 Object \u0438 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435(\u0432\u0437\u0430\u0438\u043c\u043d\u043e\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/h2>\n<p>\u0412 \u0442\u0435\u0441\u0442\u0430\u0445 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u043e\u043b\u044f\u043c \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0432 \u0444\u0430\u0439\u043b\u0435: <code>obj\/object.scm<\/code><\/p>\n<pre><code class=\"lisp\">(defclass Object () ())  (defmethod (to-s (o Object))   (inspect o nil))  (struct cycle-detect   (again first-encounter num-enc)) <\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 <strong>\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong> \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u044d\u0442\u043e <strong>\u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439<\/strong> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432,<strong> \u043f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u0438\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u0435\u0439<\/strong>. \u0418 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0432 \u0447\u0451\u043c \u0442\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430? \u041d\u043e \u0441\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, \u043d\u043e \u0438 \u043f\u043e\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b(\u0438\u043b\u0438 \u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u0438) \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u0438 <strong>\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/strong>. \u0418 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0443\u0436\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b\u043d\u044b\u043c \u043e\u0431\u0445\u043e\u0434\u043e\u043c \u043f\u043e\u043b\u0435\u0439 \u043d\u0435 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<strong> \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0446\u0438\u043a\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>, \u0447\u0442\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>inspect<\/code>.(\u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u0438 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0438 \u043e \u043d\u0438\u0445).<\/p>\n<details class=\"spoiler\">\n<summary>inspect<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(defmethod (inspect (obj Object) cycle)   ;;(prn \"inspect Object!\\n\" \"cycle: \" cycle \"\\n\")   (when (not (cycle-detect? cycle))     (set! cycle (cycle-detect! (build-storage-points-cycle obj)                                (make-storage 16 (lambda (x el) (eq? (car x) el)))                                0)))   ;;(prn \"inspect Object!\\n\" \"cycle: \" cycle \"\\n\")   (let* ((again           (cycle-detect-again           cycle))          (first-encounter (cycle-detect-first-encounter cycle))          (type   (type-obj obj))          (f1 (get-class-fields-all type))          (fields (if (not (null? f1))                      (sort-symb&lt; (map (lambda (x) (sym2key (if (pair? x)                                                                (car x)                                                                x)))                                       f1))                      f1))          (to-str-rec           (lambda (cur)             (cond              ((string? cur) cur)              ((null?   cur) \"()\")              ((boolean? cur) (if cur \"#t\" \"#f\"))              ((closure? cur) (string-append \"#CLOSURE\" (to-str-rec (get-closure-code cur))) )              ((and (atom? cur)                    (not (vector? cur))) (atom-&gt;string cur))              ((or (list? cur) (vector? cur) (pair? cur))               ;;(prn \"find list or vector or pair\\n\")               (let ((f-enc (storage-ref first-encounter cur)))                 ;;(prn \"element again used: \" (car f-enc) \"\\n\")                 (if (car f-enc) ;;\u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0441\u044f!!!                     (string-append \"#\" (atom-&gt;string (cdr (cdr f-enc))) \"#\") ;;\u0432\u043c\u0435\u0441\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e!                     (let ((cur-again (storage-ref again cur))) ;;\u043c\u043e\u0436\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u0446\u0438\u043a\u043b\u0438\u0447. \u0441\u0441\u044b\u043b\u043e\u043a?                       ;;(prn \"element may by again: \" (car cur-again) \"\\n\")                       (when (car cur-again) ;;\u0434\u0430? \u0430 \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u0435 \u043d\u0430\u0448\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435!                         (cycle-detect-num-enc! cycle (+ 1 (cycle-detect-num-enc cycle))) ;;\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0433\u043e \u043d\u043e\u043c\u0435\u0440                         (storage-add first-encounter (cons cur (cycle-detect-num-enc cycle)))) ;;\u0438 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e!                       (let ((ret                              (cond                               ((list? cur)                                (string-append \"(\" (apply string-append (insert-between-elements (map to-str-rec cur) \" \")) \")\"))                               ((hash? cur)                                ;;(prn \"Cur is hash: \" cur \"\\n\")                                (string-append \"#{\" (apply string-append (insert-between-elements (map to-str-rec (hash2pairs cur)) \" \")) \"}\"))                               ((object? cur)                                (inspect cur cycle))                               ((vector? cur)                                (string-append \"#(\" (apply string-append (insert-between-elements (map to-str-rec (vector-&gt;list cur)) \" \")) \")\"))                               ((pair? cur)                                (let ((splt (split-pairs-to-list cur)))                                  (string-append \"(\" (apply string-append (insert-between-elements (map to-str-rec (car splt)) \" \"))                                                 (if (null? (cdr splt))                                                     \"\"                                                     (string-append \" . \" (to-str-rec (cadr splt))))                                                 \")\")))                               )))                         (if (car cur-again)                             (string-append \"#\" (atom-&gt;string (cdr (cdr (storage-ref first-encounter cur)))) \"=\" ret) ;;\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043a\u0443!                             ret))) ;;\u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043d\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a                   )))                            (#t \"-bad element-\")              ))))     (let ((rez '()))       (for-list (f fields)                 (push rez (string-append (to-str f) \": \" (to-str-rec (vfield obj f)))))       (join-to-str \"#\" type \"[\" (apply join-to-str (insert-between-elements (reverse rez) \", \")) \"]\"))   )) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0443 \u0430 <strong>\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430?<\/strong> \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u0430\u043c\u0443 \u0441\u0435\u0431\u044f, \u043f\u0440\u044f\u043c\u043e \u0438\u043b\u0438 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e.<\/p>\n<pre><code class=\"lisp\">(define end-list    (cons 13 '())) (define cyclic-list (append '(1 2 3 4) end-list)) cyclic-list ;;(1 2 3 4 13) (begin   (set-car! end-list cyclic-list) ;;\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0439\u0442\u0435 \u0431\u0435\u0437 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f begin, \u0438\u043d\u0430\u0447\u0435 \u0440\u0435\u043f\u043b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 \u0437\u0430   #t) (to-str* cyclic-list) ;;\"#1=(1 2 3 4 #1#)\"  ;;\u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430: (define simple-cycle    (cons 13 '())) (begin   (set-car! simple-cycle simple-cycle) ;;\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0439\u0442\u0435 \u0431\u0435\u0437 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f begin, \u0438\u043d\u0430\u0447\u0435 \u0440\u0435\u043f\u043b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c   #t) (prn* simple-cycle) ;;#1=(#1#)  <\/code><\/pre>\n<p>\u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f <strong>\u043d\u0435 \u0432\u0441\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/strong>, \u0430 <strong>\u0442\u043e\u043b\u044c\u043a\u043e<\/strong> \u0442\u0435 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 <strong>\u0441\u0441\u044b\u043b\u043a\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/strong>(\u0442.\u0435 \u0442\u0435 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f). \u0442.\u0435 \u0434\u043b\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u044d\u0442\u043e <code>car<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0435\u0441\u043b\u0438 \u0446\u0438\u043a\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <code>cdr<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442(\u0437\u0430\u0432\u0438\u0441\u043d\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0432\u044b\u0432\u0430\u043b\u0438\u0442\u0441\u044f \u0438\u0437 \u0437\u0430 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438).<\/p>\n<h2>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b<\/h2>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/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\")) (load (string-append path-lib \"obj\/object.scm\")) (load (string-append path-lib \"tests.scm\")) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b? \u042d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0445 \u0432\u044b\u0437\u043e\u0432 \u0438 \u0441\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c.<\/p>\n<pre><code class=\"lisp\">;;\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443\u0436\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0434\u0435\u0441\u044f\u0442\u044c \u0440\u0430\u0437 \u043d\u0430\u043f\u0438\u0448\u0443 \u043c\u0430\u043a\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e (define-macro (deftest-obj1)   `(begin      (defclass a (Object)        (a))      (defclass b (a)        (b))      (defclass c (a)        (c))      (defclass d (b c)        (d))))  ;;TEST before (deftest-obj1) ;; \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 (defgeneric test-a x) (defmethod (:before test-a (x a))   (push-rez (join-to-str \":before test-a (x a), x: \" (to-s x))))  (named-test \"test :before\" test-a (list (make-a :a 12)) (check-equal '(\":before test-a (x a), x: #a[:a: 12]\" (#f)))) (named-test \"test2 :before\" test-a (list (make-d :a 1 :b 2 :c 3 :d 4)) (check-equal '(\":before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\" (#f)))) ;;PASS TEST!: `test :before` rez: (:before test-a (x a), x: #a[:a: 12] (#f)) ;;PASS TEST!: `test2 :before` rez: (:before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] (#f))  ;;TEST before before  (defmethod (:before test-a (x d))   (push-rez (join-to-str \":before test-a (x d)\")))  (named-test \"test3 :before\" test-a (list (make-a :a 12)) (check-equal '(\":before test-a (x a), x: #a[:a: 12]\" (#f)))) (named-test \"test4 :before\" test-a (list (make-d :a 1 :b 2 :c 3 :d 4))             (check-equal '(\":before test-a (x d)\" \":before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\" (#f)))) ;;PASS TEST!: `test3 :before` rez: (:before test-a (x a), x: #a[:a: 12]) ;;PASS TEST!: `test4 :before` rez: (:before test-a (x d) :before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] (#f)) <\/code><\/pre>\n<p>\u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u0432\u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0435\u0441\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<details class=\"spoiler\">\n<summary>;\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u0443 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0442\u0435\u0441\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">;;around around primary primary after after after before before before (deftest-obj1) (defgeneric test-a x)  (defmethod (:before test-a (x a))   (push-rez (join-to-str \":before test-a (x a), x: \" (to-s x))))  (defmethod (:after test-a (x a))   (push-rez (join-to-str \":after test-a (x a), x: \" (to-s x))))   (defmethod (:around test-a (x a))   (push-rez (join-to-str \":around test-a (x a), x: \" (to-s x)))   (if (next-method-p)       (call-next-method)       (vfield x :a)))  (defmethod (:around test-a (x d))   (push-rez (join-to-str \":around test-a (x d), x: \" (to-s x)))   (if (next-method-p)       (call-next-method)       (vfield x :d)))  (named-test \"test comb\" test-a (list (make-a :a 12))             (check-equal '(\":around test-a (x a), x: #a[:a: 12]\" \":before test-a (x a), x: #a[:a: 12]\"                            \":after test-a (x a), x: #a[:a: 12]\" (#f))))  (named-test \"test comb\" test-a (list (make-c :a 12 :c 13))             (check-equal '(\":around test-a (x a), x: #c[:a: 12, :c: 13]\" \":before test-a (x a), x: #c[:a: 12, :c: 13]\"                            \":after test-a (x a), x: #c[:a: 12, :c: 13]\" (#f))))  (defmethod (test-a (x a))   (push-rez (join-to-str \":primary test-a (x a), x: \" (to-s x)))   (if (next-method-p)       (call-next-method)       (vfield x :a)))  (defmethod (test-a (x d))   (push-rez (join-to-str \":primary test-a (x d), x: \" (to-s x)))   (if (next-method-p)       (call-next-method)       (vfield x :d)))  (named-test \"test comb3\" test-a (list (make-a :a 12))             (check-equal '(\":around test-a (x a), x: #a[:a: 12]\" \":before test-a (x a), x: #a[:a: 12]\"                            \":primary test-a (x a), x: #a[:a: 12]\" \":after test-a (x a), x: #a[:a: 12]\" (12))))   (named-test \"test comb4\" test-a (list (make-d :a 1 :b 2 :c 3 :d 4))             (check-equal '(\":around test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":around test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":primary test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":primary test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":after test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\" (1))))  (defmethod (:before test-a (x b))   (push-rez (join-to-str \":before test-a (x b), x: \" (to-s x))))  (defmethod (:after test-a (x b))   (push-rez (join-to-str \":after test-a (x b), x: \" (to-s x))))   (defmethod (:before test-a (x d))   (push-rez (join-to-str \":before test-a (x d), x: \" (to-s x))))  (defmethod (:after test-a (x d))   (push-rez (join-to-str \":after test-a (x d), x: \" (to-s x))))   (named-test \"test comb5\" test-a (list (make-b :a 1 :b 2))             (check-equal '(\":around test-a (x a), x: #b[:a: 1, :b: 2]\"                            \":before test-a (x b), x: #b[:a: 1, :b: 2]\"                            \":before test-a (x a), x: #b[:a: 1, :b: 2]\"                            \":primary test-a (x a), x: #b[:a: 1, :b: 2]\"                            \":after test-a (x a), x: #b[:a: 1, :b: 2]\"                            \":after test-a (x b), x: #b[:a: 1, :b: 2]\" (1))))   (named-test \"test comb6\" test-a (list (make-c :a 1 :c 3))             (check-equal '(\":around test-a (x a), x: #c[:a: 1, :c: 3]\"                            \":before test-a (x a), x: #c[:a: 1, :c: 3]\"                            \":primary test-a (x a), x: #c[:a: 1, :c: 3]\"                            \":after test-a (x a), x: #c[:a: 1, :c: 3]\" (1)))) <\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">;;PASS TEST!: `test comb` rez: (:around test-a (x a), x: #a[:a: 12] :before test-a (x a), x: #a[:a: 12] :after test-a (x a), x: #a[:a: 12] (#f)) ;;PASS TEST!: `test comb` rez: (:around test-a (x a), x: #c[:a: 12, :c: 13] ;;                              :before test-a (x a), x: #c[:a: 12, :c: 13] :after test-a (x a), x: #c[:a: 12, :c: 13] (#f))   ;; PASS TEST!: `test comb3` rez: (:around test-a (x a), x: #a[:a: 12] ;;                                :before test-a (x a), x: #a[:a: 12] ;;                                :primary test-a (x a), x: #a[:a: 12] ;;                                :after test-a (x a), x: #a[:a: 12] (12))   ;; PASS TEST!: `test comb4` rez: (:around test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                        :around test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                        :before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                        :primary test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                        :primary test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                        :after test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] (1))   ;; PASS TEST!: `test comb5` rez: (:around test-a (x a), x: #b[:a: 1, :b: 2] ;;                                        :before test-a (x b), x: #b[:a: 1, :b: 2] ;;                                        :before test-a (x a), x: #b[:a: 1, :b: 2] ;;                                        :primary test-a (x a), x: #b[:a: 1, :b: 2] ;;                                        :after test-a (x a), x: #b[:a: 1, :b: 2] ;;                                        :after test-a (x b), x: #b[:a: 1, :b: 2] (1))  ;; PASS TEST!: `test comb6` rez: (:around test-a (x a), x: #c[:a: 1, :c: 3] ;;                                        :before test-a (x a), x: #c[:a: 1, :c: 3] ;;                                        :primary test-a (x a), x: #c[:a: 1, :c: 3] ;;                                        :after test-a (x a), x: #c[:a: 1, :c: 3] (1)) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u0441\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u0441\u0442 \u0438 \u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u044b\u0437\u043e\u0432 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>test-a<\/strong> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441<strong> d<\/strong> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u044b\u0437\u043e\u0432\u0443 \u0446\u0435\u043b\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<pre><code class=\"lisp\">(named-test \"test comb7\" test-a (list (make-d :a 1 :b 2 :c 3 :d 4))             (check-equal '(\":around test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":around test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":before test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":before test-a (x b), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":primary test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":primary test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":after test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":after test-a (x b), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\"                            \":after test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4]\" (1))))   ;; PASS TEST!: `test comb7` rez: (:around test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :around test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :before test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :before test-a (x b), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :primary test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :primary test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :after test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :after test-a (x b), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] ;;                                :after test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] (1))  <\/code><\/pre>\n<p>\u0438 \u0432\u043e\u0442 \u0441\u0432\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"lisp\">(load (string-append path-work \"test-obj4.scm\"))  deftest-obj1#tPASS TEST!: `test :before` rez: (:before test-a (x a), x: #a[:a: 12] (#f)) ... ... #tPASS TEST!: `test comb7` rez: (:around test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :around test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :before test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :before test-a (x b), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :before test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :primary test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :primary test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :after test-a (x a), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :after test-a (x b), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] :after test-a (x d), x: #d[:a: 1, :b: 2, :c: 3, :d: 4] (1)) #t##t# <\/code><\/pre>\n<p>\u0418 \u0435\u0441\u043b\u0438 \u043c\u044b \u0433\u0434\u0435-\u0442\u043e, \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043a\u0430\u043a\u043e\u0435 \u0442\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"lisp\">(defmethod (test-a (x a))   (push-rez (join-to-str \":primary test-a (x a), x: \" (to-s x)))   (\/ 10 0)   ;;(push-rez (join-to-str \"ops!\"))   (if (next-method-p)       (call-next-method)       (vfield x :a)))  <\/code><\/pre>\n<p>\u0422\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u0435\u0440\u0432\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0442\u0430\u043a\u0438\u043c \u0432\u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"lisp\">#t#tFAIL TEST! (unexpected rezult) `test comb3` rez: (:around test-a (x a), x: #a[:a: 12] :before test-a (x a), x: #a[:a: 12] :primary test-a (x a), x: #a[:a: 12] ops! :after test-a (x a), x: #a[:a: 12] (12)) Error: FAIL TEST! (unexpected rezult) `test comb3`  <\/code><\/pre>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u0411\u0435\u0437\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0434\u0430\u00a0\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u00a0\u043c\u043e\u0436\u0435\u0442. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 <strong>\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0418\u041d\u0412\u0410\u0420\u0418\u0410\u041d\u0422 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/strong>, \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0430\u0441\u0442 \u043e\u0442\u0432\u0435\u0442 \u043f\u0440\u0438\u00a0\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432\u00a0\u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u044d\u0442\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0430\u0448\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u043b\u0438\u00a0\u0443\u0436\u0435 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438\u00a0\u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u00a0\u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0448 \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0442\u043e \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a\u043e\u0434 \u0432\u00a0\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0435\u043c\u0443 \u043d\u043e\u0432\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0418 \u043c\u044b \u0421\u041c\u041e\u0413\u041b\u0418 <strong>\u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432\u00a0\u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442<\/strong>, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u0437\u0430\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u00a0\u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043c\u043e\u0436\u043d\u043e\u00a0\u0431\u044b\u0442\u044c \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u044b\u043c. \u041d\u0443 \u0430\u00a0\u0431\u0435\u0437\u00a0\u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u0430\u043a\u00a0\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f: \u00ab\u0442\u043e \u043b\u0430\u043f\u044b \u043b\u043e\u043c\u0438\u0442, \u0442\u043e \u0445\u0432\u043e\u0441\u0442 \u043e\u0442\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0430\u00a0\u043d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0435\u0449\u0451\u00a0\u043b\u0438\u043d\u044f\u0442\u044c \u043d\u0430\u0447\u0430\u043b&#8230; \u0438\u00a0\u0442.\u00a0\u0434.\u00bb.<\/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\/934092\/\"> https:\/\/habr.com\/ru\/articles\/934092\/<\/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>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430 \u041b\u0438\u0441\u043f \u044d\u0442\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u044f \u043d\u0435 \u0437\u043d\u0430\u044e(\u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e \u0438\u0445 \u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u044f \u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u044e) \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0446\u0438\u043a\u043b: \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434 &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430(\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435) \u0431\u044b\u043b \u0431\u044b \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c. \u041a\u0441\u0442\u0430\u0442\u0438 \u0432 Script-fu \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0447\u0435\u0440\u0435\u0437 \u0431\u0443\u0444\u0435\u0440 \u043e\u0431\u043c\u0435\u043d\u0430, \u044d\u0442\u043e \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e! \u0422\u0430\u043c \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u0437 \u0415\u043c\u0430\u043a\u0441, \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0435\u0440 Scrip-fu, \u043d\u043e \u044f \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e(\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c), \u0430 \u0441 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0438\u043b\u0438 \u043b\u0438\u0441\u043f\u043e\u043c, \u0440\u0430\u0431\u043e\u0442\u0430 \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043a\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043f\u0430\u0440\u044b \u043a\u043b\u0430\u0432\u0438\u0448. \u041b\u0438\u0441\u043f\u0435\u0440\u044b \u043d\u0435 \u043f\u0438\u0448\u0443\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0438 \u043a\u043e\u0434\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0442, \u043e\u043d\u0438 \u043f\u0438\u0448\u0443\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0435\u0433\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0442. \u0412\u0441\u0451 \u044d\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 <strong>REPL<\/strong>. \u0418 \u0432\u0441\u0451 \u0442\u0430\u043a\u0438 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0430\u0451\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 <strong>\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b,<\/strong> \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 <strong>\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/strong>, \u0430 \u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0442\u043e \u043b\u0438\u0431\u043e \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0438 \u043a\u0430\u043a\u0430\u044f \u043d\u0438\u0431\u0443\u0434\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430 \u043e\u0442\u0432\u0430\u043b\u0438\u0442\u0441\u044f.<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435(\u0432 \u0441\u0432\u044f\u0437\u0438 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432) \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f <strong>\u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0435<\/strong> <strong>\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/strong> \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438, \u043f\u043e \u043c\u0438\u043c\u043e \u043d\u0438\u0445, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u043b\u044f\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0442.\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0442.\u0434. \u0422\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u0438 \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438,  \u0447\u0435\u043c \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438.<\/p>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u043e \u0441 \u0440\u0438\u0441\u043a\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0431\u043e \u043e\u0442\u043a\u0430\u0437\u0430, \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"lisp\">(define *test-rezult* '()) (define-m (push-rez x)   (push *test-rezult* x))  ;;\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. (define (test-func func args comp-func)   (set! *test-rezult* '())   (let ((rez (catch (begin  '())                (cons (apply func args) '()))))     (set! *test-rezult* (reverse (cons rez *test-rezult*))) (if (not (null? rez))         (if (apply comp-func (list *test-rezult*))             (cons #t *test-rezult*)             (cons #f *test-rezult*))     (cons rez *test-rezult*)))) <\/code><\/pre>\n<p>\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439: <strong>\u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442<\/strong> \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0433\u043e<strong> \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong> \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431 \u044d\u0442\u043e\u043c(\u043f\u0443\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430) \u0432\u044b\u0448\u0435\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/p>\n<details class=\"spoiler\">\n<summary>\u0442\u0435\u0441\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(define (t1 x1)   (\/ 10 x1))  (t1 10) ;;1 (t1 0) ;;Error: \/: division by zero   (test-func t1 '(2) (lambda (x) (if (not (null? (car x)))                                (begin (prn \"args: \" x \"\\n\") (= (caar x) 5))     #f))) ;;(#t (5))  \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 5 \u0438 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e  (test-func t1 '(2) (lambda (x) (if (not (null? (car x)))                                (begin (prn \"args: \" x \"\\n\") (= (caar x) 4))    #f))) ;;(#f (5)) \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 5 \u0438 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e(\u043c\u044b \u043e\u0436\u0438\u0434\u0430\u043b\u0438 4).  (test-func t1 '(0) (lambda (x) (if (not (null? (car x)))                                (begin (prn \"args: \" x \"\\n\") (= (caar x) 4))    #f))) ;;(() ())# \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043f\u0435\u0440\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u0434\u0448\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0435 <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u0448\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442 \u0442\u0440\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u0434\u0448\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u041f\u043e \u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043f\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u043c\u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u044f \u0432\u0432\u0451\u043b \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code><em>test-rezult<\/em><\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c <code>push-rez<\/code> \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0414\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0449\u0443\u044e \u043d\u0430\u043c \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"lisp\">(define-m (named-test name func args comp-func)   (let ((rez (test-func func args comp-func)))     (cond      ((null? (car rez))       (prn \"FAIL TEST! (executed error!) `\" name \"` rez: \" (cdr rez) \"\\n\")   (throw (join-to-str \"FAIL TEST! (executed error!) `\" name \"`\")))      ((car rez)       (prn \"PASS TEST!: `\" name \"` rez: \" (cdr rez) \"\\n\"))      ((not (car rez))       (prn \"FAIL TEST! (unexpected rezult) `\" name \"` rez: \" (cdr rez) \"\\n\")   (throw (join-to-str  \"FAIL TEST! (unexpected rezult) `\" name \"`\")))      (#t       (prn \"UNKNOWN TEST RESULT `\" name \"` args: \" args \", rez: \"  rez \"\\n\")))     ))   (define-macro (check-equal param)   (let ((var    (gensym)))     `(lambda (,var) (equal?  ,param ,var)))) <\/code><\/pre>\n<p>\u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c <strong>\u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/strong> \u043f\u0440\u0438 \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"lisp\">(define (test-t1 x)   (push-rez \"Start test\")   (let ((rez (t1 x)))     (push-rez \"End test\") rez))  (named-test \"test1 t1\" test-t1 '(5) (check-equal '(\"Start test\" \"End test\" (2)))) ;;PASS TEST!: `test1 t1` rez: (Start test End test (2))  (named-test \"test1 t1\" test-t1 '(0) (check-equal '(\"Start test\" \"End test\" (2)))) ;;FAIL TEST! (executed error!) `test1 t1` rez: (Start test ()) ;;Error: FAIL TEST! (executed error!) `test1 t1`   (named-test \"test1 t1\" test-t1 '(4) (check-equal '(\"Start test\" \"End test\" (2)))) ;;FAIL TEST! (unexpected rezult) `test1 t1` rez: (Start test End test (2,5.0)) ;;Error: FAIL TEST! (unexpected rezult) `test1 t1`  <\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h2>\u041a\u043b\u0430\u0441\u0441 Object \u0438 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435(\u0432\u0437\u0430\u0438\u043c\u043d\u043e\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/h2>\n<p>\u0412 \u0442\u0435\u0441\u0442\u0430\u0445 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u043e\u043b\u044f\u043c \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0432 \u0444\u0430\u0439\u043b\u0435: <code>obj\/object.scm<\/code><\/p>\n<pre><code class=\"lisp\">(defclass Object () ())  (defmethod (to-s (o Object))   (inspect o nil))  (struct cycle-detect   (again first-encounter num-enc)) <\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 <strong>\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong> \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u044d\u0442\u043e <strong>\u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439<\/strong> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432,<strong> \u043f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u0438\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u0435\u0439<\/strong>. \u0418 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0432 \u0447\u0451\u043c \u0442\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430? \u041d\u043e \u0441\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, \u043d\u043e \u0438 \u043f\u043e\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b(\u0438\u043b\u0438 \u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u0438) \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u0438 <strong>\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/strong>. \u0418 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0443\u0436\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b\u043d\u044b\u043c \u043e\u0431\u0445\u043e\u0434\u043e\u043c \u043f\u043e\u043b\u0435\u0439 \u043d\u0435 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<strong> \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0446\u0438\u043a\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>, \u0447\u0442\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>inspect<\/code>.(\u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u0438 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0438 \u043e \u043d\u0438\u0445).<\/p>\n<details class=\"spoiler\">\n<summary>inspect<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"lisp\">(defmethod (inspect (obj Object) cycle)   ;;(prn \"inspect Object!\\n\" \"cycle: \" cycle \"\\n\")   (when (not (cycle-detect? cycle))     (set! cycle (cycle-detect! (build-storage-points-cycle obj)                                (make-storage 16 (lambda (x el) (eq? (car x) el)))                                0)))   ;;(prn \"inspect Object!\\n\" \"cycle: \" cycle \"\\n\")   (let* ((again           (cycle-detect-again           cycle))          (first-encounter (cycle-detect-first-encounter cycle))          (type   (type-obj obj))          (f1 (get-class-fields-all type))          (fields (if (not (null? f1))                      (sort-symb&lt; (map (lambda (x) (sym2key (if (pair? x)                                                                (car x)                                                                x)))                                       f1))                      f1))          (to-str-rec           (lambda (cur)             (cond              ((string? cur) cur)              ((null?   cur) \"()\")              ((boolean? cur) (if cur \"#t\" \"#f\"))              ((closure? cur) (string-append \"#CLOSURE\" (to-str-rec (get-closure-code cur))) )              ((and (atom? cur)                    (not (vector? cur))) (atom-&gt;string cur))              ((or (list? cur) (vector? cur) (pair? cur))               ;;(prn \"find list or vector or pair\\n\")               (let ((f-enc (storage-ref first-encounter cur)))                 ;;(prn \"element again used: \" (car f-enc) \"\\n\")                 (if (car f-enc) ;;\u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0441\u044f!!!                     (string-append \"#\" (atom-&gt;string (cdr (cdr f-enc))) \"#\") ;;\u0432\u043c\u0435\u0441\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e!                     (let ((cur-again (storage-ref again cur))) ;;\u043c\u043e\u0436\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u0446\u0438\u043a\u043b\u0438\u0447. \u0441\u0441\u044b\u043b\u043e\u043a?                       ;;(prn \"element may by again: \" (car cur-again) \"\\n\")                       (when (car cur-again) ;;\u0434\u0430? \u0430 \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u0435 \u043d\u0430\u0448\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435!                         (cycle-detect-num-enc! cycle (+ 1 (cycle-detect-num-enc cycle))) ;;\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0433\u043e \u043d\u043e\u043c\u0435\u0440                         (storage-add first-encounter (cons cur (cycle-detect-num-enc cycle)))) ;;\u0438 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e!                       (let ((ret                              (cond                               ((list? cur)                                (string-append \"(\" (apply string-append (insert-between-elements (map to-str-rec cur) \" \")) \")\"))                               ((hash? cur)                                ;;(prn \"Cur is hash: \" cur \"\\n\")                                (string-append \"#{\" (apply string-append (insert-between-elements (map to-str-rec (hash2pairs cur)) \" \")) \"}\"))                               ((object? cur)                                (inspect cur cycle))                               ((vector? cur)                                (string-append \"#(\" (apply string-append (insert-between-elements (map to-str-rec (vector-&gt;list cur)) \" \")) \")\"))                               ((pair? cur)                                (let ((splt (split-pairs-to-list cur)))                                  (string-append \"(\" (apply string-append (insert-between-elements (map to-str-rec (car splt)) \" \"))                                                 (if (null? (cdr splt))                                                     \"\"                                                     (string-append \" . \" (to-str-rec (cadr splt))))                                                 \")\")))                               )))                         (if (car cur-again)                             (string-append \"#\" (atom-&gt;string (cdr (cdr (storage-ref first-encounter cur)))) \"=\" ret)<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-469624","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/469624","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=469624"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/469624\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=469624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=469624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=469624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}