{"id":345231,"date":"2023-02-10T03:00:40","date_gmt":"2023-02-10T03:00:40","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=345231"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=345231","title":{"rendered":"<span>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 Turbo Prolog<\/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<h2>\u0422\u0435\u043e\u0440\u0438\u044f<\/h2>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433\u0435<\/em><\/strong>\u00a0\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432. \u041a \u043d\u0438\u043c \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>clauses<\/strong>\u00a0<strong><em>(\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439)<\/em><\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>predicates<\/strong>\u00a0<strong><em>(\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432)<\/em><\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>domains<\/strong>\u00a0<strong><em>(\u0434\u043e\u043c\u0435\u043d\u043e\u0432)<\/em><\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>goal<\/strong>\u00a0<strong><em>(\u0446\u0435\u043b\u0435\u0439)<\/em><\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>clauses<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u0441\u0435\u0440\u0434\u0446\u0435\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433<\/em><\/strong>-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b; \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u043a\u0442\u044b \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433<\/em><\/strong>, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0446\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>predicates<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0438 \u0434\u043e\u043c\u0435\u043d\u044b (\u0442\u0438\u043f\u044b) \u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>domains\u00a0<\/strong>\u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043d\u0430\u043c\u0438 \u0434\u043e\u043c\u0435\u043d\u043e\u0432, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0434\u043e\u043c\u0435\u043d\u0430\u043c\u0438\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433\u0430<\/em><\/strong>.<\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>goal<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0435 \u0446\u0435\u043b\u044c\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433<\/em><\/strong>-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h3>\u0411\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0411\u0414 \u0432 Turbo Prolog \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <strong>database<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c predicates. \u0412\u0441\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430\u043c\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 database, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 <strong>\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0411\u0414<\/strong>. <\/p>\n<p>\u0411\u0414 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0443 \u043d\u0435\u0435 (\u0411\u0414) \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 \u043d\u0435\u0439 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0411\u0414 (\u0414\u0411\u0414) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a \u0438 \u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u0441 \u043d\u0435\u0433\u043e \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 \u0414\u0411\u0414 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u043a\u0442\u044b, \u043d\u043e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u0412 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0444\u0430\u043a\u0442\u0430\u043c\u0438 \u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. <\/p>\n<h4>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414<\/h4>\n<p>\u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b: <\/p>\n<ul>\n<li>\n<p><strong>asserta(fact)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>asserta(fact, dbaseName)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<li>\n<p><strong>assertz(fact)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>assertz(fact, dbaseName)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u043a\u0442\u043e\u0432 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430: <\/p>\n<ul>\n<li>\n<p><strong>consult(fileName)<\/strong> \/\/ \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>consult(fileName, dbaseName)<\/strong> \/\/ \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<\/ul>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u0430:<\/p>\n<ul>\n<li>\n<p><strong>retract(fact)<\/strong> \/\/ \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>retract(fact, dbaseName)<\/strong> \/\/ \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b\u0435:<\/p>\n<ul>\n<li>\n<p><strong>save(fileName)<\/strong> \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom \u0432 \u0444\u0430\u0439\u043b\u0435 fileName <\/p>\n<\/li>\n<li>\n<p><strong>save(fileName, dbaseName)<\/strong> \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName \u0432 \u0444\u0430\u0439\u043b\u0435 fileName<\/p>\n<\/li>\n<\/ul>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h2>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u2014 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a, \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u0434\u0430\u043b\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>Name\u00a0\u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>Price (RUB)\u00a0\u2014 \u0446\u0435\u043d\u0430 \u0432\u00a0\u0440\u0443\u0431\u043b\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p>Sex\u00a0\u2014 \u043c\u0443\u0436\u0441\u043a\u0430\u044f \u0438\u043b\u0438\u00a0\u0436\u0435\u043d\u0441\u043a\u0430\u044f \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>Size (International)\u00a0\u2014 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Size (Europe)\u00a0\u2014 \u0435\u0432\u0440\u043e\u043f\u0435\u0439\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Color\u00a0\u2014 \u0446\u0432\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>Material\u00a0\u2014 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Production year \u2014 \u0433\u043e\u0434 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430. <\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<ol>\n<li>\n<p>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 CSV-\u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 CSV-\u0444\u0430\u0439\u043b;<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b;<\/p>\n<\/li>\n<\/ol>\n<h2>\u041a\u043e\u0434<\/h2>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0434\u0451\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0434\u043e\u043c\u0435\u043d\u043e\u0432, \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432:<\/p>\n<pre><code class=\"erlang\">Domains      name, world, color, sex, material = string % \u0434\u043e\u043c\u0435\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430      europe, year, price = integer % \u0434\u043e\u043c\u0435\u043d\u044b \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430  file = datafile % \u0434\u043e\u043c\u0435\u043d \u0442\u0438\u043f\u0430 file  arr = string* % \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a  integers = integer* % \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b Database      dt_shirt(name, price, sex, world, europe, color, material, year) % \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 \u0411\u0414 Predicates      repeat % \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0435\u0442 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430      do_mbase % \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 menu      menu % \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043c\u0435\u043d\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b      process(integer) % \u0436\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u043c\u0435\u043d\u044e \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0451      clear_database % \u043e\u0447\u0438\u0449\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445      error % \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435  read_until_not_integer(integer) % \u0436\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0430 \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430  write_all % \u0432\u044b\u0432\u043e\u0434 \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443  write_all(arr,integers,arr,arr,integers,arr,arr,integers) % \u0432\u044b\u0432\u043e\u0434 \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443  write_all_csv % \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 csv \u0444\u0430\u0439\u043b  write_all_csv(arr,integers,arr,arr,integers,arr,arr,integers) % \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 csv \u0444\u0430\u0439\u043b  read_rows() % \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430  front_string(string, string, string) % \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 csv \u0434\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f ;  read_prov(integer) % \u0432\u0432\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u043c\u0435\u043d\u044e  find(integer) % \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430  find_shirt_name(string) % \u043f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0438  find_material(string) % \u043f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443  find_name(string)   find_mat(string) <\/code><\/pre>\n<p>\u0427\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b Goal, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"erlang\">Goal      do_mbase. % \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 do_mbase<\/code><\/pre>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 <strong>Clauses<\/strong>. \u0417\u0434\u0435\u0441\u044c \u044f \u043e\u043f\u0438\u0448\u0443 \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>repeat<\/strong> &#8212; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u043d\u0438\u044f. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f:<\/p>\n<pre><code class=\"erlang\">repeat. repeat:-repeat.<\/code><\/pre>\n<p><strong>read_prov<\/strong> &#8212; \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e, \u0438\u043d\u0430\u0447\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>error<\/strong>:   <\/p>\n<pre><code class=\"erlang\">read_prov(Vibor):-                  readint(Vibor);                  error,                 Vibor = 0,                 menu.<\/code><\/pre>\n<h4>\u041c\u0435\u043d\u044e<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/66e\/5b9\/97e\/66e5b997ed84833bb4fb14c0b5777586.png\" alt=\"\u041c\u0435\u043d\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" title=\"\u041c\u0435\u043d\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" width=\"665\" height=\"248\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/66e\/5b9\/97e\/66e5b997ed84833bb4fb14c0b5777586.png\"\/><figcaption>\u041c\u0435\u043d\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<p><strong>do_mbase<\/strong> &#8212; \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0421\u043e\u0437\u0434\u0430\u0451\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <strong>menu<\/strong>.<\/p>\n<p><strong>menu<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043c\u0435\u043d\u044e \u0438 \u0436\u0434\u0435\u0442 \u043f\u043e\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u0435\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 1 \u0434\u043e 9. \u041f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>process,<\/strong> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0434\u0435\u0432\u044f\u0442\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"erlang\">do_mbase :-           makewindow(1,11,3,\" T-SHIRTS DATABASE \",0,0,25,80),           menu,           clear_database.   menu :-           repeat, clearwindow,           nl,           write(\" ********************************* \"),nl,           write(\" * 1. Read Database from file    * \"),nl,           write(\" * 2. Add new T-shirt in DB      * \"),nl,           write(\" * 3. Delete T-shirt from DB     * \"),nl,           write(\" * 4. Edit T-shirt in DB         * \"),nl,           write(\" * 5. Find T-shirt               * \"),nl,           write(\" * 6. Show all data              * \"),nl,           write(\" * 7. Write Database to file     * \"),nl,           write(\" * 8. Delete All DB              * \"),nl,           write(\" * 9. Exit                       * \"),nl,           write(\" ********************************* \"),nl,           write(\" Choose number 1-9 : \"),           read_prov(Vibor),nl,           process(Vibor),Vibor = 9.<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u043f\u0438\u0448\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<h3>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/h3>\n<h4>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1c0\/eaa\/a21\/1c0eaaa21f03af4b3915ea08c41a5b1a.png\" alt=\"\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430\" title=\"\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430\" width=\"667\" height=\"290\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1c0\/eaa\/a21\/1c0eaaa21f03af4b3915ea08c41a5b1a.png\"\/><figcaption>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430<\/figcaption><\/figure>\n<p><strong>process(1)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u044f csv \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 <strong>read_rows()<\/strong>. \u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0411\u0414 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;DB successfully read from file.&#187;. \u041f\u0440\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f &#171;Error reading file!&#187;. \u0417\u0430\u0442\u0435\u043c, \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u0430, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043c\u0435\u043d\u044e.<\/p>\n<pre><code class=\"erlang\">process(1) :-           makewindow(2,11,3,\"Read data from file\",2,20,15,40),shiftwindow(2),           write(\"Input File name (data.csv): \"),           readln(Filename),            existfile(Filename),           openread(datafile, Filename),            readdevice(datafile),           read_rows(),           closefile(datafile), readdevice(keyboard),           write(\"DB successfully read from file.\"),nl,!,           write(\"Press space bar\"), readchar(_),            removewindow, shiftwindow(1), clearwindow, menu;              write(\"Error reading file!\"), nl, !,           write(\"Press space bar.\"),readchar(_),           removewindow, shiftwindow(1), clearwindow, menu, fail.<\/code><\/pre>\n<p><strong>read_rows() <\/strong>\u2014 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 csv \u0444\u0430\u0439\u043b, \u043f\u0440\u0438\u00a0\u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u043e\u0441\u044c\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 (\u0443 \u043d\u0430\u0441 8\u00a0\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u00a0\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445) \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 <strong>front_string<\/strong>. \u041f\u043e\u0441\u043b\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u00a0\u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <strong>dt_shirt<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>assertz<\/strong>.<\/p>\n<p><strong>front_string(Line, Param, Tail) <\/strong>\u2014 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442 csv \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u2011 ;<\/p>\n<p>\u0418\u043c\u0435\u0435\u0442 3\u00a0\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: <\/p>\n<ol>\n<li>\n<p>Line\u00a0\u2014 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>Param\u00a0\u2014 \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043e\u00a0\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u2011 ;<\/p>\n<\/li>\n<li>\n<p>Tail\u00a0\u2014 \u043e\u0441\u0442\u0430\u0432\u0448\u0430\u044f\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u2011 ;<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"erlang\">read_rows() :-not(eof(datafile)),                 readln(Line),                 front_string(Line, F1_STR, Tail1),                  front_string(Tail1, F2_STR, Tail2), str_int(F2_STR, Price),                 front_string(Tail2, F3_STR, Tail3),                  front_string(Tail3, F4_STR, Tail4),                  front_string(Tail4, F5_STR, Tail5), str_int(F5_STR, Europe),                 front_string(Tail5, F6_STR, Tail6),                  front_string(Tail6, F7_STR, Tail7),                  front_string(Tail7, F8_STR, _), str_int(F8_STR, Year),                 assertz(dt_shirt(F1_STR,Price,F3_STR,F4_STR,Europe,F6_STR,F7_STR,Year)), !, read_rows();                                  not(eof(datafile)), !,                 write(\" ********************************\"), nl,                 write(\" *        READING ERROR!        * \"), nl,                 write(\" * REMAINING DATA WAS NOT READ! * \"), nl,                 write(\" *     SOME MATERIALS ADDED!    * \"), nl,                 write(\" ******************************** \"), nl; !.  front_string(\"\", \"\", \"\") :- !. front_string(Line, Param, Tail) :-frontchar(Line, LineH, LineT),                                  LineH = ';', !,                                  Param = \"\", Tail = LineT;                                                                  frontchar(Line, LineH, LineT),                                  LineH &lt;> ';', !,                                  front_string(LineT, T, Tail),                                  str_char(LineHS, LineH),                                 concat(LineHS, T, Param).<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9f7\/2b7\/e9d\/9f72b7e9dca8bba873785cc2ccc35181.png\" alt=\"\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445\" title=\"\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"555\" height=\"273\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9f7\/2b7\/e9d\/9f72b7e9dca8bba873785cc2ccc35181.png\"\/><figcaption>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/figure>\n<p><strong>process(2)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438. \u0412\u0432\u043e\u0434 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>read_until_not_integer<\/strong>. \u041f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043e\u043d\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u00a0\u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <strong>dt_shirt<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>assertz<\/strong>.<\/p>\n<pre><code class=\"erlang\">process(2) :-         makewindow(3,11,3,\"Add data\",2,20,18,58),shiftwindow(3),         write(\"Please, Input T-shirt:\"),nl,         write(\"Name: \"), readln(Name),         write(\"Price (RUB): \"), read_until_not_integer(Price),         write(\"Sex: \"), readln(Sex),         write(\"Size (International) : \"), readln(World),         write(\"Size (Europe): \"), read_until_not_integer(Europe),         write(\"Color: \"), readln(Color),         write(\"Material: \"), readln(Material),         write(\"Production year: \"), read_until_not_integer(Year),         assertz(dt_shirt(Name,Price,Sex,World,Europe,Color, Material,Year)),         write(Name,\" added to DB\"), nl,!,         write(\"Press space bar. \"), readchar(_),         removewindow, shiftwindow(1), clearwindow, menu.<\/code><\/pre>\n<p><strong>read_until_not_integer<\/strong> &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0435 0 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.<\/p>\n<pre><code class=\"erlang\">read_until_not_integer(Integer):-         readint(Integer),         Integer >=0, !;                  write(\"Enter integer number >=0: \"),         read_until_not_integer(Integer).<\/code><\/pre>\n<h4>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/83f\/7cb\/a3e\/83f7cba3e85481175460fec9df52dbae.png\" alt=\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\" title=\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"601\" height=\"271\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/83f\/7cb\/a3e\/83f7cba3e85481175460fec9df52dbae.png\"\/><figcaption>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/figure>\n<p><strong>process(3)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438, \u043e\u043d\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <strong>dt_shirt<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>retract<\/strong>.<\/p>\n<pre><code class=\"erlang\">process(3) :-         makewindow(4,11,3,\"Delete data\",10,30,7,40),shiftwindow(4),         write(\"Input T-shirt name: \"), readln(Name),         retract(dt_shirt(Name,_,_,_,_,_,_,_)),         write(Name,\" removed from DB \"), nl, !,         write(\"Press space bar.\"), readchar(_),          removewindow, shiftwindow(1);                  write(\"No data.\"),nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1).<\/code><\/pre>\n<h4>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0435<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/523\/d15\/0c0\/523d150c0007432738cae2028c56e027.png\" width=\"667\" height=\"335\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/523\/d15\/0c0\/523d150c0007432738cae2028c56e027.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>process(4)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438, \u043e\u043d\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <strong>dt_shirt<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>retract<\/strong>. \u0414\u0430\u043b\u0435\u0435 \u0432\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c<\/p>\n<pre><code class=\"erlang\">process(4) :-           makewindow(5,11,3,\"Edit data\",2,20,18,58),shiftwindow(5),           write(\"Input T-shirt name: \"), readln(Name1),           retract(dt_shirt(Name1,_,_,_,_,_,_,_)),           write(\"Name: \"), readln(Name),           write(\"Price (RUB): \"), read_until_not_integer(Price),           write(\"Sex: \"), readln(Sex),           write(\"Size (International) : \"), readln(World),           write(\"Size (Europe): \"), read_until_not_integer(Europe),           write(\"Color: \"), readln(Color),           write(\"Material: \"), readln(Material),           write(\"Production year: \"), read_until_not_integer(Year),           assertz(dt_shirt(Name,Price,Sex,World,Europe,Color, Material,Year)),nl, !,           write(\"Press space bar.\"), readchar(_),            removewindow, shiftwindow(1);                      write(\"No data.\"),nl,!,           write(\"Press space bar.\"),readchar(_),           removewindow, shiftwindow(1), clearwindow, menu.<\/code><\/pre>\n<h4>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0435<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/61e\/ae7\/fd0\/61eae7fd04b1c2a2fcd87bccc3abdc2e.png\" alt=\"1-\u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e; 2-\u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443\" title=\"1-\u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e; 2-\u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443\" width=\"663\" height=\"248\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/61e\/ae7\/fd0\/61eae7fd04b1c2a2fcd87bccc3abdc2e.png\"\/><figcaption>1-\u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e; 2-\u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ba8\/ca9\/e7a\/ba8ca9e7aa6b52a4bb21c72e2c5285eb.png\" alt=\"\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e (\u0441\u043b\u0435\u0432\u0430);                                                \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443 (\u0441\u043f\u0440\u0430\u0432\u0430)\" title=\"\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e (\u0441\u043b\u0435\u0432\u0430);                                                \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443 (\u0441\u043f\u0440\u0430\u0432\u0430)\" width=\"776\" height=\"178\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ba8\/ca9\/e7a\/ba8ca9e7aa6b52a4bb21c72e2c5285eb.png\"\/><figcaption>\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e (\u0441\u043b\u0435\u0432\u0430);                                                \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443 (\u0441\u043f\u0440\u0430\u0432\u0430)<\/figcaption><\/figure>\n<p><strong>process(5)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c, \u043a\u0430\u043a \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0443: 1 &#8212; \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438\u043b\u0438 2 &#8212; \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>find<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043d\u0435\u0439.<\/p>\n<pre><code class=\"erlang\">process(5) :-         makewindow(6,11,3,\" Show T-shirt \", 2,30,22,47),  shiftwindow(6),         write(\"1. Find T-shirt by Name \"),nl,         write(\"2. Find T-shirt by Material \"),nl,          write(\" Choose number 1-2 : \"),         read_until_not_integer(N),          N>0,N&lt;3,         find(N),         write(\"Press space bar\"), readchar(_),          removewindow, shiftwindow(1), clearwindow, menu;          write(\"Wrong input.\"),nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1), clearwindow, menu.<\/code><\/pre>\n<p><strong>find(1)<\/strong> &#8212; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>find_shirt_name<\/strong>, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e, \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0435. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;No such T-shirt in database!&#187;.<\/p>\n<p><strong>find(2)<\/strong> &#8212; \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e <strong>find(1)<\/strong>, \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0439 \u043d\u0430\u0441 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438.<\/p>\n<pre><code class=\"erlang\">find(1):-clearwindow, write(\"Input T-shirt name: \"), readln(Name),                   find_shirt_name(Name), find_name(Name).  find(1):-write(\"No such T-shirt in database!\").  find(2):-clearwindow, write(\"Input T-shirt material: \"), readln(Material),                   find_material(Material), find_mat(Material).  find(2):-write(\"No such T-shirt in database!\").  find(_):-write(\"Error \").  find_shirt_name(Name):-          dt_shirt(Name,Price,Sex,World,Europe,Color, Material,Year),nl,         write(\" Name                : \",Name),nl,         write(\" Price (RUB)         : \",Price),nl,         write(\" Sex                 : \",Sex),nl,         write(\" Size (International): \",World),nl,         write(\" Size (Europe):      : \",Europe), nl,         write(\" Color               : \",Color),nl,         write(\" Material            : \",Material),nl,         write(\" Production year     : \",Year),nl, nl, fail. find_shirt_name(_).  find_material(Material):-         dt_shirt(Name,Price,Sex,World,Europe,Color, Material,Year),nl,         write(\" Name                : \",Name),nl,         write(\" Price (RUB)         : \",Price),nl,         write(\" Sex                 : \",Sex),nl,         write(\" Size (International): \",World),nl,         write(\" Size (Europe):      : \",Europe), nl,         write(\" Color               : \",Color),nl,         write(\" Material            : \",Material),nl,         write(\" Production year     : \",Year),nl, nl, fail. find_material(_).  find_name(Name):-dt_shirt(Name,_,_,_,_,_,_,_). find_mat(Material):-dt_shirt(_,_,_,_,_,_,Material,_).<\/code><\/pre>\n<h4>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/348\/de4\/8bc\/348de48bc8cbbf5e8cd3ce86de9353e7.png\" alt=\"\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445\" title=\"\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"664\" height=\"361\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/348\/de4\/8bc\/348de48bc8cbbf5e8cd3ce86de9353e7.png\"\/><figcaption>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/figure>\n<p><strong>process(6)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>write_all<\/strong>.<\/p>\n<pre><code class=\"erlang\">process(6) :-         makewindow(7,11,3,\" Show All data \", 0,0,25,80),  shiftwindow(7),         write(\"Name, Price(Rub), Sex, Size(Inter.), Size(Europe), Color, Material, Year\"),         nl,         write(\"************************************************************************\"),         nl,         write_all,         nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1), clearwindow, menu;                  write(\"No data.\"),nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1), clearwindow, menu.<\/code><\/pre>\n<p><strong>write_all()<\/strong> &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u00a0<strong>findall(X,P,L)<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a\u00a0L\u00a0\u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b\u00a0X, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u0446\u0435\u043b\u0438\u00a0P.<\/p>\n<p><strong>write_all([P1|T1], [P2|T2], [P3|T3], [P4|T4], [P5|T5], [P6|T6], [P7|T7], [P8|T8])<\/strong> &#8212; \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e.<\/p>\n<pre><code class=\"erlang\">write_all() :-     findall(P1, dt_shirt(P1,_,_, _,_,_,_,_), P1s),     findall(P2, dt_shirt(_,P2,_,_,_,_,_,_ ), P2s),     findall(P3, dt_shirt(_,_,P3, _,_,_,_,_), P3s),     findall(P4, dt_shirt(_,_,_,P4,_,_,_,_ ), P4s),     findall(P5, dt_shirt(_,_,_,_,P5,_,_,_ ), P5s),     findall(P6, dt_shirt(_,_,_,_,_,P6,_,_ ), P6s),     findall(P7, dt_shirt(_,_,_, _,_,_,P7,_), P7s),     findall(P8, dt_shirt(_,_,_, _,_,_,_,P8), P8s),     write_all(P1s, P2s, P3s, P4s, P5s, P6s, P7s, P8s);     writedevice(screen).  write_all([], [], [], [], [], [], [], []) :- !. write_all([P1|T1], [P2|T2], [P3|T3], [P4|T4], [P5|T5], [P6|T6], [P7|T7], [P8|T8]) :-           write(P1,\", \",           P2,\" (RUB), \",           P3,\", \",           P4,\", \",           P5,\", \",           P6,\", \",           P7,\", \",           P8),nl,           write(\"------------------------------------------------------------------------\"),nl,           write_all(T1, T2, T3, T4, T5, T6, T7, T8).<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b csv<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dc7\/ea1\/e60\/dc7ea1e60ef757f191d87834676b3d63.png\" alt=\"\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b csv\" title=\"\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b csv\" width=\"603\" height=\"331\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dc7\/ea1\/e60\/dc7ea1e60ef757f191d87834676b3d63.png\"\/><figcaption>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b csv<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2a0\/64e\/d11\/2a064ed1184c470039fdf9e71e75660b.png\" alt=\"\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 CSV \u0444\u0430\u0439\u043b\u0435\" title=\"\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 CSV \u0444\u0430\u0439\u043b\u0435\" width=\"738\" height=\"321\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2a0\/64e\/d11\/2a064ed1184c470039fdf9e71e75660b.png\"\/><figcaption>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 CSV \u0444\u0430\u0439\u043b\u0435<\/figcaption><\/figure>\n<p><strong>process(7)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043d\u0430 \u0444\u0430\u0439\u043b &#8212; <strong>writedevice(datafile)<\/strong> \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>write_all_csv<\/strong>, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"erlang\">process(7) :-         makewindow(8,11,3,\" Write Database to file \", 7,30,12,47),  shiftwindow(8),         write(\"Input file name (data.csv): \"),         readln(Filename),         existfile(Filename), % \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0444\u0430\u0439\u043b          openwrite(datafile, Filename),          writedevice(datafile),          write_all_csv,         closefile(datafile),          writedevice(screen),         write(\"DB successfully written to file.\"),         nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1), clearwindow, menu;                  write(\"Error writing file!\"),nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1), clearwindow, menu.<\/code><\/pre>\n<p><strong>write_all_csv()<\/strong> &#8212; \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e <strong>write_all()<\/strong>, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043f\u044f\u0442\u044b\u0445, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c &#8212; ;. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 csv \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"erlang\">write_all_csv() :-     findall(P1, dt_shirt(P1,_,_, _,_,_,_,_), P1s),     findall(P2, dt_shirt(_,P2,_,_,_,_,_,_ ), P2s),     findall(P3, dt_shirt(_,_,P3, _,_,_,_,_), P3s),     findall(P4, dt_shirt(_,_,_,P4,_,_,_,_ ), P4s),     findall(P5, dt_shirt(_,_,_,_,P5,_,_,_ ), P5s),     findall(P6, dt_shirt(_,_,_,_,_,P6,_,_ ), P6s),     findall(P7, dt_shirt(_,_,_, _,_,_,P7,_), P7s),     findall(P8, dt_shirt(_,_,_, _,_,_,_,P8), P8s),     write_all_csv(P1s, P2s, P3s, P4s, P5s, P6s, P7s, P8s);     writedevice(screen).  write_all_csv([], [], [], [], [], [], [], []) :- !. write_all_csv([P1|T1], [P2|T2], [P3|T3], [P4|T4], [P5|T5], [P6|T6], [P7|T7], [P8|T8]) :-           write(P1,\"; \",           P2,\"; \",           P3,\"; \",           P4,\"; \",           P5,\"; \",           P6,\"; \",           P7,\"; \",           P8),nl,     write_all_csv(T1, T2, T3, T4, T5, T6, T7, T8).<\/code><\/pre>\n<h4>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/475\/750\/8cf\/4757508cffb412a7aa19c5619898faf5.png\" alt=\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\" title=\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"664\" height=\"303\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/475\/750\/8cf\/4757508cffb412a7aa19c5619898faf5.png\"\/><figcaption>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/figure>\n<p><strong>process(8)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;DB has been cleared&#187;. \u041f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u0442\u0441\u044f &#171;Error writing file!&#187;.<\/p>\n<pre><code class=\"erlang\">process(8) :-         makewindow(9,11,3,\" Delete All DB \",10,30,7,40),  shiftwindow(9),         clear_database,         write(\"DB has been cleared\"),         nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1), clearwindow, menu;                  write(\"Error writing file!\"),nl,!,         write(\"Press space bar.\"),readchar(_),         removewindow, shiftwindow(1), clearwindow, menu.<\/code><\/pre>\n<p><strong>clear_database <\/strong>&#8212; \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0444\u0430\u043a\u0442\u044b \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>retract<\/strong>:<\/p>\n<pre><code class=\"erlang\"> clear_database:-           retract(dt_shirt(_,_,_,_,_,_,_,_)),           fail.  clear_database:-!.<\/code><\/pre>\n<h4>\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6dd\/213\/46e\/6dd21346e08e3c7a893d143ec5fbd806.png\" alt=\"\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b\" title=\"\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b\" width=\"631\" height=\"258\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6dd\/213\/46e\/6dd21346e08e3c7a893d143ec5fbd806.png\"\/><figcaption>\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/figcaption><\/figure>\n<p><strong>process(9)<\/strong> &#8212; \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;See you again! &#171;.<\/p>\n<pre><code class=\"erlang\">process(9) :-         clear_database,         write(\"See you again! \"),readchar(_),exit.<\/code><\/pre>\n<h2>\u041a\u043e\u043d\u0435\u0446<\/h2>\n<p>\u0412\u043e\u0442 \u0432\u0440\u043e\u0434\u0435 \u0438 \u0432\u0441\u0435. <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0447\u0442\u043e \u0438\u0441\u043a\u0430\u043b\u0438)<\/p>\n<blockquote>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434: <a href=\"https:\/\/github.com\/KirillTaE\/Dynamic_DataBase_on_TurboProlog\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/KirillTaE\/Dynamic_DataBase_on_TurboProlog<\/a><\/p>\n<\/blockquote>\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\/post\/716012\/\"> https:\/\/habr.com\/ru\/post\/716012\/<\/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<h2>\u0422\u0435\u043e\u0440\u0438\u044f<\/h2>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433\u0435<\/em><\/strong>\u00a0\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432. \u041a \u043d\u0438\u043c \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>clauses<\/strong>\u00a0<strong><em>(\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439)<\/em><\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>predicates<\/strong>\u00a0<strong><em>(\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432)<\/em><\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>domains<\/strong>\u00a0<strong><em>(\u0434\u043e\u043c\u0435\u043d\u043e\u0432)<\/em><\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u00a0<strong>goal<\/strong>\u00a0<strong><em>(\u0446\u0435\u043b\u0435\u0439)<\/em><\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>clauses<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u0441\u0435\u0440\u0434\u0446\u0435\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433<\/em><\/strong>-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b; \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u043a\u0442\u044b \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433<\/em><\/strong>, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0446\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>predicates<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0438 \u0434\u043e\u043c\u0435\u043d\u044b (\u0442\u0438\u043f\u044b) \u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>domains\u00a0<\/strong>\u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043d\u0430\u043c\u0438 \u0434\u043e\u043c\u0435\u043d\u043e\u0432, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0434\u043e\u043c\u0435\u043d\u0430\u043c\u0438\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433\u0430<\/em><\/strong>.<\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b\u00a0<strong>goal<\/strong>\u00a0&#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0435 \u0446\u0435\u043b\u044c\u00a0<strong><em>\u041f\u0440\u043e\u043b\u043e\u0433<\/em><\/strong>-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h3>\u0411\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0411\u0414 \u0432 Turbo Prolog \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <strong>database<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c predicates. \u0412\u0441\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430\u043c\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 database, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 <strong>\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0411\u0414<\/strong>. <\/p>\n<p>\u0411\u0414 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0443 \u043d\u0435\u0435 (\u0411\u0414) \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 \u043d\u0435\u0439 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0411\u0414 (\u0414\u0411\u0414) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a \u0438 \u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u0441 \u043d\u0435\u0433\u043e \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 \u0414\u0411\u0414 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u043a\u0442\u044b, \u043d\u043e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u0412 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0444\u0430\u043a\u0442\u0430\u043c\u0438 \u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. <\/p>\n<h4>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414<\/h4>\n<p>\u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b: <\/p>\n<ul>\n<li>\n<p><strong>asserta(fact)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>asserta(fact, dbaseName)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<li>\n<p><strong>assertz(fact)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>assertz(fact, dbaseName)<\/strong> \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u043a\u0442\u043e\u0432 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430: <\/p>\n<ul>\n<li>\n<p><strong>consult(fileName)<\/strong> \/\/ \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>consult(fileName, dbaseName)<\/strong> \/\/ \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<\/ul>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u0430:<\/p>\n<ul>\n<li>\n<p><strong>retract(fact)<\/strong> \/\/ \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom <\/p>\n<\/li>\n<li>\n<p><strong>retract(fact, dbaseName)<\/strong> \/\/ \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName <\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b\u0435:<\/p>\n<ul>\n<li>\n<p><strong>save(fileName)<\/strong> \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbasedom \u0432 \u0444\u0430\u0439\u043b\u0435 fileName <\/p>\n<\/li>\n<li>\n<p><strong>save(fileName, dbaseName)<\/strong> \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 dbaseName \u0432 \u0444\u0430\u0439\u043b\u0435 fileName<\/p>\n<\/li>\n<\/ul>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h2>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u2014 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a, \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u0434\u0430\u043b\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>Name\u00a0\u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>Price (RUB)\u00a0\u2014 \u0446\u0435\u043d\u0430 \u0432\u00a0\u0440\u0443\u0431\u043b\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p>Sex\u00a0\u2014 \u043c\u0443\u0436\u0441\u043a\u0430\u044f \u0438\u043b\u0438\u00a0\u0436\u0435\u043d\u0441\u043a\u0430\u044f \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>Size (International)\u00a0\u2014 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Size (Europe)\u00a0\u2014 \u0435\u0432\u0440\u043e\u043f\u0435\u0439\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Color\u00a0\u2014 \u0446\u0432\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>Material\u00a0\u2014 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Production year \u2014 \u0433\u043e\u0434 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430. <\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<ol>\n<li>\n<p>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 CSV-\u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 CSV-\u0444\u0430\u0439\u043b;<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b;<\/p>\n<\/li>\n<\/ol>\n<h2>\u041a\u043e\u0434<\/h2>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0434\u0451\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0434\u043e\u043c\u0435\u043d\u043e\u0432, \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432:<\/p>\n<pre><code class=\"erlang\">Domains      name, world, color, sex, material = string % \u0434\u043e\u043c\u0435\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430      europe, year, price = integer % \u0434\u043e\u043c\u0435\u043d\u044b \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430  file = datafile % \u0434\u043e\u043c\u0435\u043d \u0442\u0438\u043f\u0430 file  arr = string* % \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a  integers = integer* % \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b Database      dt_shirt(name, price, sex, world, europe, color, material, year) % \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 \u0411\u0414 Predicates      repeat % \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0435\u0442 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430      do_mbase % \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 menu      menu % \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043c\u0435\u043d\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b      process(integer) % \u0436\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u043c\u0435\u043d\u044e \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0451      clear_database % \u043e\u0447\u0438\u0449\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445      error % \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435  read_until_not_integer(integer) % \u0436\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0430 \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430  write_all % \u0432\u044b\u0432\u043e\u0434 \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443  write_all(arr,integers,arr,arr,integers,arr,arr,integers) % \u0432\u044b\u0432\u043e\u0434 \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443  write_all_csv % \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 csv \u0444\u0430\u0439\u043b  write_all_csv(arr,integers,arr,arr,integers,arr,arr,integers) % \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0441\u0435\u0445 \u0444\u0443\u0442\u0431\u043e\u043b\u043e\u043a \u0432 csv \u0444\u0430\u0439\u043b  read_rows() % \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430  front_string(string, string, string) % \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 csv \u0434\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f ;  read_prov(integer) % \u0432\u0432\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u043c\u0435\u043d\u044e  find(integer) % \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430  find_shirt_name(string) % \u043f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0438  find_material(string) % \u043f\u043e\u0438\u0441\u043a \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443  find_name(string)   find_mat(string) <\/code><\/pre>\n<p>\u0427\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b Goal, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre><code class=\"erlang\">Goal      do_mbase. % \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 do_mbase<\/code><\/pre>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 <strong>Clauses<\/strong>. \u0417\u0434\u0435\u0441\u044c \u044f \u043e\u043f\u0438\u0448\u0443 \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>repeat<\/strong> &#8212; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u043d\u0438\u044f. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f:<\/p>\n<pre><code class=\"erlang\">repeat. repeat:-repeat.<\/code><\/pre>\n<p><strong>read_prov<\/strong> &#8212; \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e, \u0438\u043d\u0430\u0447\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>error<\/strong>:   <\/p>\n<pre><code class=\"erlang\">read_prov(Vibor):-                  readint(Vibor);                  error,                 Vibor = 0,                 menu.<\/code><\/pre>\n<h4>\u041c\u0435\u043d\u044e<\/h4>\n<figure class=\"full-width\"><figcaption>\u041c\u0435\u043d\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<p><strong>do_mbase<\/strong> &#8212; \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0421\u043e\u0437\u0434\u0430\u0451\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <strong>menu<\/strong>.<\/p>\n<p><strong>menu<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043c\u0435\u043d\u044e \u0438 \u0436\u0434\u0435\u0442 \u043f\u043e\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u0435\u0434\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 1 \u0434\u043e 9. \u041f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>process,<\/strong> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0434\u0435\u0432\u044f\u0442\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"erlang\">do_mbase :-           makewindow(1,11,3,\" T-SHIRTS DATABASE \",0,0,25,80),           menu,           clear_database.   menu :-           repeat, clearwindow,           nl,           write(\" ********************************* \"),nl,           write(\" * 1. Read Database from file    * \"),nl,           write(\" * 2. Add new T-shirt in DB      * \"),nl,           write(\" * 3. Delete T-shirt from DB     * \"),nl,           write(\" * 4. Edit T-shirt in DB         * \"),nl,           write(\" * 5. Find T-shirt               * \"),nl,           write(\" * 6. Show all data              * \"),nl,           write(\" * 7. Write Database to file     * \"),nl,           write(\" * 8. Delete All DB              * \"),nl,           write(\" * 9. Exit                       * \"),nl,           write(\" ********************************* \"),nl,           write(\" Choose number 1-9 : \"),           read_prov(Vibor),nl,           process(Vibor),Vibor = 9.<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u043f\u0438\u0448\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<h3>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/h3>\n<h4>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430<\/h4>\n<figure class=\"full-width\"><figcaption>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 csv \u0444\u0430\u0439\u043b\u0430<\/figcaption><\/figure>\n<p><strong>process(1)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u044f csv \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 <strong>read_rows()<\/strong>. \u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0411\u0414 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;DB successfully read from file.&#187;. \u041f\u0440\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f &#171;Error reading file!&#187;. \u0417\u0430\u0442\u0435\u043c, \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u0430, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043c\u0435\u043d\u044e.<\/p>\n<pre><code class=\"erlang\">process(1) :-           makewindow(2,11,3,\"Read data from file\",2,20,15,40),shiftwindow(2),           write(\"Input File name (data.csv): \"),           readln(Filename),            existfile(Filename),           openread(datafile, Filename),            readdevice(datafile),           read_rows(),           closefile(datafile), readdevice(keyboard),           write(\"DB successfully read from file.\"),nl,!,           write(\"Press space bar\"), readchar(_),            removewindow, shiftwindow(1), clearwindow, menu;              write(\"Error reading file!\"), nl, !,           write(\"Press space bar.\"),readchar(_),           removewindow, shiftwindow(1), clearwindow, menu, fail.<\/code><\/pre>\n<p><strong>read_rows() <\/strong>\u2014 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 csv \u0444\u0430\u0439\u043b, \u043f\u0440\u0438\u00a0\u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u043e\u0441\u044c\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 (\u0443 \u043d\u0430\u0441 8\u00a0\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u00a0\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445) \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 <strong>front_string<\/strong>. \u041f\u043e\u0441\u043b\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u00a0\u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <strong>dt_shirt<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>assertz<\/strong>.<\/p>\n<p><strong>front_string(Line, Param, Tail) <\/strong>\u2014 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443, \u043f\u043e\u043a\u0430 \u043d\u0435\u00a0\u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442 csv \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u2011 ;<\/p>\n<p>\u0418\u043c\u0435\u0435\u0442 3\u00a0\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: <\/p>\n<ol>\n<li>\n<p>Line\u00a0\u2014 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>Param\u00a0\u2014 \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043e\u00a0\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u2011 ;<\/p>\n<\/li>\n<li>\n<p>Tail\u00a0\u2014 \u043e\u0441\u0442\u0430\u0432\u0448\u0430\u044f\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u2011 ;<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"erlang\">read_rows() :-not(eof(datafile)),                 readln(Line),                 front_string(Line, F1_STR, Tail1),                  front_string(Tail1, F2_STR, Tail2), str_int(F2_STR, Price),                 front_string(Tail2, F3_STR, Tail3),                  front_string(Tail3, F4_STR, Tail4),                  front_string(Tail4, F5_STR, Tail5), str_int(F5_STR, Europe),                 front_string(Tail5, F6_STR, Tail6),                  front_string(Tail6, F7_STR, Tail7),                  front_string(Tail7, F8_STR, _), str_int(F8_STR, Year),                 assertz(dt_shirt(F1_STR,Price,F3_STR,F4_STR,Europe,F6_STR,F7_STR,Year)), !, read_rows();                                  not(eof(datafile)), !,                 write(\" ********************************\"), nl,                 write(\" *        READING ERROR!        * \"), nl,                 write(\" * REMAINING DATA WAS NOT READ! * \"), nl,                 write(\" *     SOME MATERIALS ADDED!    * \"), nl,                 write(\" ******************************** \"), nl; !.  front_string(\"\", \"\", \"\") :- !. front_string(Line, Param, Tail) :-frontchar(Line, LineH, LineT),                                  LineH = ';', !,                                  Param = \"\", Tail = LineT;                                                                  frontchar(Line, LineH, LineT),                                  LineH &lt;> ';', !,                                  front_string(LineT, T, Tail),                                  str_char(LineHS, LineH),                                 concat(LineHS, T, Param).<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<figure class=\"full-width\"><figcaption>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/figure>\n<p><strong>process(2)<\/strong> &#8212; \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0438. \u0412\u0432\u043e\u0434 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>read_until_not_integer<\/strong>. \u041f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043e\u043d\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u00a0\u043a\u043e\u043d\u0435\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <strong>dt_shirt<\/strong>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <strong>assertz<\/strong>.<\/p>\n<pre><code class=\"erlang\">process(2) :-         makewindow(3,11,3,\"Add data\",2,20,18,58),shiftwindow(3),         write(\"Please, Input T-shirt:\"),nl,         write(\"Name: \"), readln(Name),         write(\"Price (RUB): \"), read_until_not_integer(Price),         write(\"Sex: \"), readln(Sex),         write(\"Size (International) : \"), readln(World),         write(\"Size (Europe): \"), read_until_not_integer(Europe),         write(\"Color: \"), readln(Color),         write(\"Material: \"), readln(Material), <\/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-345231","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/345231","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=345231"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/345231\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=345231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=345231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=345231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}