{"id":3555,"date":"2024-11-22T19:04:22","date_gmt":"2024-11-22T13:34:22","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=3555"},"modified":"2024-11-22T19:04:52","modified_gmt":"2024-11-22T13:34:52","slug":"multiobjective-optimization-moo-in-lisp-and-prolog","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/22\/multiobjective-optimization-moo-in-lisp-and-prolog\/","title":{"rendered":"Multiobjective Optimization (MOO) in Lisp and Prolog"},"content":{"rendered":"<p>Recently I came across a nice <a href=\"https:\/\/medium.com\/codex\/forget-programming-languages-code-with-maths-instead-f2a20ec27645\" target=\"_blank\" rel=\"noopener\"><em><strong>article<\/strong><\/em><\/a>\u00a0by Jose Crespo, where the author stresses that the future of programming revolves around the application of math concepts such as <em><strong>Functor<\/strong><\/em>, <em><strong>Monads<\/strong><\/em>, <em><strong>Folds<\/strong><\/em>, etc. In addition, he argues that familiarity with <em><strong>C\/C++<\/strong><\/em> is essential in this modern AI age.<\/p>\n<p>The author goes through a toy example that uses <em><strong>time<\/strong><\/em> and <em><strong>energy<\/strong><\/em> to show how <em><strong>Multiobjective Optimization (MOO)<\/strong><\/em> framework can be quite useful in the real world.<\/p>\n<p>I strongly urge readers to go through that article before continuing, since what follows is based on that article.<\/p>\n<p>What impressed me most about the article was the elegant and compact <em><strong>C++<\/strong><\/em> code (using the latest language features) that shows how to use <em><strong>Pareto Front<\/strong><\/em> approach to consider both <em><strong>time<\/strong><\/em> and <em><strong>energy<\/strong><\/em> for arriving at an optimal solution.<\/p>\n<p>Readers may know that my favourite <em><strong>top<\/strong><\/em> three programming languages are <a href=\"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/07\/why-learn-c\/\" target=\"_blank\" rel=\"noopener\"><em><strong>C++<\/strong><\/em><\/a>, <a href=\"https:\/\/www.rangakrish.com\/index.php\/2022\/10\/20\/why-learn-lisp\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Common Lisp<\/strong><\/em><\/a>\u00a0and <a href=\"https:\/\/www.rangakrish.com\/index.php\/2022\/10\/06\/why-learn-prolog\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Prolog<\/strong><\/em><\/a>. So when I finished reading that article, I wanted to rewrite the solution in <em><strong>Lisp<\/strong><\/em> and <em><strong>Prolog<\/strong><\/em>.<\/p>\n<p>Here is the Lisp code:<\/p>\n<figure id=\"attachment_3558\" aria-describedby=\"caption-attachment-3558\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"3558\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/22\/multiobjective-optimization-moo-in-lisp-and-prolog\/lisp-code-3\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code.jpg\" data-orig-size=\"927,1117\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1732266687&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Lisp Code for Pareto Front\" data-image-description=\"&lt;p&gt;Lisp Code for Pareto Front&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Lisp Code for Pareto Front&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code-850x1024.jpg\" class=\"wp-image-3558\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code.jpg?resize=500%2C602&#038;ssl=1\" alt=\"Lisp Code for Pareto Front\" width=\"500\" height=\"602\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code.jpg?resize=249%2C300&amp;ssl=1 249w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code.jpg?resize=850%2C1024&amp;ssl=1 850w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code.jpg?resize=768%2C925&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-code.jpg?w=927&amp;ssl=1 927w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-3558\" class=\"wp-caption-text\"><strong>Lisp Code for Pareto Front<\/strong><\/figcaption><\/figure>\n<p>Here is the program output:<\/p>\n<figure id=\"attachment_3559\" aria-describedby=\"caption-attachment-3559\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-output.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"3559\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/22\/multiobjective-optimization-moo-in-lisp-and-prolog\/lisp-output-2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-output.jpg\" data-orig-size=\"785,291\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1732266739&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Program Output\" data-image-description=\"&lt;p&gt;Program Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Program Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-output.jpg\" class=\"wp-image-3559\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-output.jpg?resize=400%2C148&#038;ssl=1\" alt=\"Program Output\" width=\"400\" height=\"148\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-output.jpg?resize=300%2C111&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-output.jpg?resize=768%2C285&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/lisp-output.jpg?w=785&amp;ssl=1 785w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-3559\" class=\"wp-caption-text\"><strong>Program Output<\/strong><\/figcaption><\/figure>\n<p>The Lisp program is no less elegant in my opinion! Of course <em><strong>Lisp<\/strong><\/em> is a dynamically typed language and hence the performance (space and time) is likely to be marginally inferior to <em><strong>C++<\/strong><\/em> (by the way, <em><strong>LispWorks<\/strong><\/em> has a great compiler that can generate optimized native code for the <em><strong>Lisp<\/strong><\/em> program). Keeping efficiency aside, the remarkable thing about <em><strong>Common Lisp<\/strong><\/em> is its support for <em><strong>Multimethods<\/strong><\/em> and <em><strong>Meta Object Protocol (MOP)<\/strong><\/em>.<\/p>\n<p>Now, let us look at the equivalent Prolog program:<\/p>\n<figure id=\"attachment_3560\" aria-describedby=\"caption-attachment-3560\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"3560\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/22\/multiobjective-optimization-moo-in-lisp-and-prolog\/prolog-code1\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1.jpg\" data-orig-size=\"857,1028\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1732266536&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Prolog Code\" data-image-description=\"&lt;p&gt;Prolog Code&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Prolog Code&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1-854x1024.jpg\" class=\"wp-image-3560\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1.jpg?resize=500%2C600&#038;ssl=1\" alt=\"Prolog Code\" width=\"500\" height=\"600\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1.jpg?resize=250%2C300&amp;ssl=1 250w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1.jpg?resize=854%2C1024&amp;ssl=1 854w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1.jpg?resize=768%2C921&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code1.jpg?w=857&amp;ssl=1 857w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-3560\" class=\"wp-caption-text\"><strong>Prolog Code<\/strong><\/figcaption><\/figure>\n<p>The <em><strong>main<\/strong><\/em> predicate follows:<\/p>\n<figure id=\"attachment_3561\" aria-describedby=\"caption-attachment-3561\" style=\"width: 450px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code2.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3561\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/22\/multiobjective-optimization-moo-in-lisp-and-prolog\/prolog-code2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code2.jpg\" data-orig-size=\"713,497\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1732266573&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Prolog-code2\" data-image-description=\"&lt;p&gt;Prolog &amp;#8220;main&amp;#8221; Predicate&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Prolog &amp;#8220;main&amp;#8221; Predicate&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code2.jpg\" class=\"wp-image-3561\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code2.jpg?resize=450%2C314&#038;ssl=1\" alt=\"Prolog &quot;main&quot; Predicate\" width=\"450\" height=\"314\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code2.jpg?resize=300%2C209&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/Prolog-code2.jpg?w=713&amp;ssl=1 713w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/a><figcaption id=\"caption-attachment-3561\" class=\"wp-caption-text\"><strong>Prolog &#8220;main&#8221; Predicate<\/strong><\/figcaption><\/figure>\n<p>When you run the program, this is the output:<\/p>\n<figure id=\"attachment_3562\" aria-describedby=\"caption-attachment-3562\" style=\"width: 450px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/prolog-output.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3562\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/22\/multiobjective-optimization-moo-in-lisp-and-prolog\/prolog-output\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/prolog-output.jpg\" data-orig-size=\"1003,535\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Prolog Output\" data-image-description=\"&lt;p&gt;Prolog Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Prolog Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/prolog-output.jpg\" class=\"wp-image-3562\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/prolog-output.jpg?resize=450%2C240&#038;ssl=1\" alt=\"Prolog Output\" width=\"450\" height=\"240\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/prolog-output.jpg?resize=300%2C160&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/prolog-output.jpg?resize=768%2C410&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/prolog-output.jpg?w=1003&amp;ssl=1 1003w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/a><figcaption id=\"caption-attachment-3562\" class=\"wp-caption-text\"><strong>Prolog Output<\/strong><\/figcaption><\/figure>\n<p>In both <em><strong>Lisp<\/strong><\/em> and <em><strong>Prolog<\/strong><\/em>, the result matches the <em><strong>C++<\/strong><\/em> output (as described in the article).<\/p>\n<p>I chose <em><strong>Prolog<\/strong><\/em> to show that the logic can be implemented in this language too, but it would not be my natural choice for this implementation.<\/p>\n<p>The point is that while <em><strong>C++<\/strong><\/em> is arguably the best language to implement most algorithms, especially with the features available in the recent language specifications, if not running on embedded systems or on resource-critical systems, then languages such as <em><strong>Lisp<\/strong><\/em> are equally good choices for implementing such algorithms.<\/p>\n<p>You can download the <a href=\"https:\/\/www.rangakrish.com\/downloads\/Pareto-front.lisp\" target=\"_blank\" rel=\"noopener\"><em><strong>Lisp<\/strong><\/em><\/a>\u00a0and <a href=\"https:\/\/www.rangakrish.com\/downloads\/Pareto-front.pro\" target=\"_blank\" rel=\"noopener\"><em><strong>Prolog<\/strong><\/em><\/a>\u00a0code here.<\/p>\n<p>Have a nice weekend!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I came across a nice article\u00a0by Jose Crespo, where the author stresses that the future of programming revolves around the application of math concepts such as Functor, Monads, Folds, etc. In addition, he argues that familiarity with C\/C++ is essential in this modern AI age. The author goes through a toy example that uses [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[49,18,17,147],"tags":[67,19,409,148],"class_list":["post-3555","post","type-post","status-publish","format-standard","hentry","category-c","category-lisp","category-programming","category-prolog","tag-c","tag-lisp","tag-multiobjective-optimization","tag-prolog"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-Vl","jetpack-related-posts":[{"id":2832,"url":"https:\/\/www.rangakrish.com\/index.php\/2022\/06\/12\/definite-clause-grammars-in-lisp-part-4\/","url_meta":{"origin":3555,"position":0},"title":"Definite Clause Grammars in Lisp &#8211; Part 4","author":"admin","date":"June 12, 2022","format":false,"excerpt":"In a series of articles\u00a0written earlier, I had shown how it is possible to model Definite Clause Grammars (DCG) in LispWorks Lisp (Enterprise Edition). We use defgrammar\u00a0in Common Prolog (available as part of KnowledgeWorks package) to define our grammar rules. Here is a toy English grammar represented using defgrammar: This\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"DCG Using Defgrammar","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/06\/defgrammar-version-300x177.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/06\/defgrammar-version-300x177.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/06\/defgrammar-version-300x177.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2366,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/03\/28\/implementing-ilexicon-using-litedb\/","url_meta":{"origin":3555,"position":1},"title":"Implementing iLexicon using LiteDB","author":"admin","date":"March 28, 2021","format":false,"excerpt":"iLexicon is an \"intelligent\" dictionary that can be used to build Natural Language applications. I have two implementations, one in Lisp and another in Prolog. Both implementations are memory-based, in order to speed up performance. I have written several articles referencing it, for example see this. \u00a0 LiteDB is a\u2026","rel":"","context":"In &quot;Natural Language Processing&quot;","block_context":{"text":"Natural Language Processing","link":"https:\/\/www.rangakrish.com\/index.php\/category\/natural-language-processing\/"},"img":{"alt_text":"Sample Commands","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/03\/Session1.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2935,"url":"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/07\/why-learn-c\/","url_meta":{"origin":3555,"position":2},"title":"Why Learn C++","author":"admin","date":"November 7, 2022","format":false,"excerpt":"This is the third and the last article in the series \u201cWhy Learn Language-XYZ?\u201d. I talked about Prolog and Lisp earlier. The present article is on C++. Once you have gained reasonable proficiency with Prolog and Lisp, you are ready to learn C++! In my view, C++ is a complex\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2927,"url":"https:\/\/www.rangakrish.com\/index.php\/2022\/10\/20\/why-learn-lisp\/","url_meta":{"origin":3555,"position":3},"title":"Why Learn Lisp?","author":"admin","date":"October 20, 2022","format":false,"excerpt":"In the last article, I had shared my views on why programmers should learn Prolog, preferably as the first language. What language should one learn next? I strongly pitch for Lisp, to be precise, \u201cCommon Lisp\u201d. Lisp happens to be the second oldest (1958) programming language, only after Fortran (1957)!\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3271,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/12\/10\/generating-polynomials-part-2\/","url_meta":{"origin":3555,"position":4},"title":"Generating Polynomials &#8211; Part 2","author":"admin","date":"December 10, 2023","format":false,"excerpt":"In my last article, I showed how we can use Prolog to generate univariate Polynomials. After I finished that article, I wanted to try Lisp for the same task. Prolog is \u201cdeclarative\u201d, whereas Lisp is primarily \u201cfunctional\u201d (it supports OOP as well), so the implementation will exhibit that difference. Here\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Function to Generate Polynomial","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/12\/code1-300x139.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/12\/code1-300x139.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/12\/code1-300x139.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2334,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/02\/28\/calling-c-methods-from-lispworks-lisp-through-com-interface\/","url_meta":{"origin":3555,"position":5},"title":"Calling C# Methods from LispWorks Lisp through COM Interface","author":"admin","date":"February 28, 2021","format":false,"excerpt":"In an earlier article, I showed how to invoke C# methods from Sicstus Prolog. Today, I would like to detail the steps for doing the same from LispWorks Lisp. LispWorks Enterprise Edition comes budled with support for COM and Automation. This is what we will be using. What this means\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"The COM Server in C#","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/02\/C-Code-300x267.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/3555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=3555"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/3555\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=3555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=3555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=3555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}