{"id":2620,"date":"2021-11-28T08:36:15","date_gmt":"2021-11-28T03:06:15","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=2620"},"modified":"2021-11-28T08:36:15","modified_gmt":"2021-11-28T03:06:15","slug":"understanding-the-unify-function-in-newlisp","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/","title":{"rendered":"Understanding the &#8220;unify&#8221; Function in &#8220;newLisp&#8221;"},"content":{"rendered":"<p><em><strong>Unification<\/strong><\/em> between two symbolic expressions involves finding substitutions for variables (if any) in the expressions such that the expressions <em><strong>match<\/strong><\/em>\u00a0after applying the substitutions. This is a powerful idea and is quite common in logic programming languages such as <em><strong>Prolog<\/strong><\/em>.<\/p>\n<p>Interestingly, <em><strong>&#8220;newLisp&#8221;<\/strong><\/em> has a buil-in function called <a href=\"http:\/\/www.newlisp.org\/downloads\/newlisp_manual.html#unify\" target=\"_blank\" rel=\"noopener\"><em><strong>&#8220;unify&#8221;<\/strong><\/em><\/a> that can be used for unifying two expressions. In this article, let us go over several examples of this function.<\/p>\n<p>Let us start with a simple case involving <em><strong>atomic<\/strong><\/em> elements:<\/p>\n<figure id=\"attachment_2621\" aria-describedby=\"caption-attachment-2621\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example1-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"2621\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/example1-26\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example1-1.jpg\" data-orig-size=\"642,226\" 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;1638020689&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=\"Unifying &amp;#8220;atomic&amp;#8221; expressions\" data-image-description=\"&lt;p&gt;Unifying &amp;#8220;atomic&amp;#8221; expressions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Unifying &amp;#8220;atomic&amp;#8221; expressions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example1-1.jpg\" class=\"wp-image-2621\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example1-1.jpg?resize=500%2C176&#038;ssl=1\" alt=\"Unifying &quot;atomic&quot; expressions\" width=\"500\" height=\"176\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example1-1.jpg?resize=300%2C106&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example1-1.jpg?w=642&amp;ssl=1 642w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2621\" class=\"wp-caption-text\"><strong>Unifying &#8220;atomic&#8221; expressions<\/strong><\/figcaption><\/figure>\n<p>The <em><strong>&#8220;unify&#8221;<\/strong><\/em> function returns a <em><strong>&#8220;bindings&#8221;<\/strong><\/em> list, that is, a list of possible substitutions for the variables, if any. If the two expressions cannot be unified, it returns nil.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>In the above case, there is a match only when the two expressions are <em><strong>identical<\/strong><\/em>. Since there are no variables in the expressions, if the <em><strong>match<\/strong><\/em> is successful, an empty list is returned.<\/p>\n<p>It gets interesting when we introduce one or more <em><strong>variables<\/strong><\/em> in the expressions. Variables start with an uppercase letter in order to distinguish them from other elements of the expression.<\/p>\n<figure id=\"attachment_2622\" aria-describedby=\"caption-attachment-2622\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example2-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"2622\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/example2-22\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example2-1.jpg\" data-orig-size=\"394,411\" 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;1638083292&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=\"Expressions with Variables\" data-image-description=\"&lt;p&gt;Expressions with Variables&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Expressions with Variables&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example2-1.jpg\" class=\"wp-image-2622\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example2-1.jpg?resize=400%2C417&#038;ssl=1\" alt=\"Expressions with Variables\" width=\"400\" height=\"417\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example2-1.jpg?resize=288%2C300&amp;ssl=1 288w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example2-1.jpg?w=394&amp;ssl=1 394w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-2622\" class=\"wp-caption-text\"><strong>Expressions with Variables<\/strong><\/figcaption><\/figure>\n<p>In the first case above, the variable <em><strong>&#8220;X&#8221;<\/strong><\/em> can be directly unified with the literal <em><strong>&#8220;Hi&#8221;<\/strong><\/em>. The third case shows that we can have variables in both expressions. The next four cases involve only variables, no literals. The reason the last case fails is because of mismatch between the number of elements in each expression.<\/p>\n<p>We can use the special symbol <em><strong>&#8220;_&#8221;<\/strong><\/em> as a variable to match any single element, but it does not get bound to what it matches. See the following examples:<\/p>\n<figure id=\"attachment_2623\" aria-describedby=\"caption-attachment-2623\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example3-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"2623\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/example3-19\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example3-1.jpg\" data-orig-size=\"544,276\" 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;1638025160&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=\"Using Underscore\" data-image-description=\"&lt;p&gt;Using Underscore&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Using Underscore&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example3-1.jpg\" class=\"wp-image-2623\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example3-1.jpg?resize=500%2C254&#038;ssl=1\" alt=\"Using Underscore\" width=\"500\" height=\"254\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example3-1.jpg?resize=300%2C152&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example3-1.jpg?w=544&amp;ssl=1 544w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2623\" class=\"wp-caption-text\"><strong>Using Underscore<\/strong><\/figcaption><\/figure>\n<p>As you can guess, the last two expressions fail because of mismatch in the number of elements.<\/p>\n<p>The <em><strong>&#8220;unify&#8221;<\/strong><\/em> function optionally takes a third parameter &#8211; a binding list. This is used as needed when unifying the first two expressions.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<figure id=\"attachment_2624\" aria-describedby=\"caption-attachment-2624\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example4-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2624\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/example4-14\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example4-1.jpg\" data-orig-size=\"527,166\" 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;1638040182&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=\"Passing an Optional Bindings List\" data-image-description=\"&lt;p&gt;Passing an Optional Bindings List&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Passing an Optional Bindings List&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example4-1.jpg\" class=\"wp-image-2624\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example4-1.jpg?resize=500%2C157&#038;ssl=1\" alt=\"Passing an Optional Bindings List\" width=\"500\" height=\"157\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example4-1.jpg?resize=300%2C94&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example4-1.jpg?w=527&amp;ssl=1 527w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2624\" class=\"wp-caption-text\"><strong>Passing an Optional Bindings List<\/strong><\/figcaption><\/figure>\n<p>If the binding list includes variables other than those present in the first two expressions, then those are also included in the final list of bindings:<\/p>\n<figure id=\"attachment_2625\" aria-describedby=\"caption-attachment-2625\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example5-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2625\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/example5-11\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example5-1.jpg\" data-orig-size=\"547,119\" 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;1638040313&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=\"Extra Variables in the Bindings List\" data-image-description=\"&lt;p&gt;Extra Variables in the Bindings List&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Extra Variables in the Bindings List&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example5-1.jpg\" class=\"wp-image-2625\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example5-1.jpg?resize=500%2C109&#038;ssl=1\" alt=\"Extra Variables in the Bindings List\" width=\"500\" height=\"109\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example5-1.jpg?resize=300%2C65&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example5-1.jpg?w=547&amp;ssl=1 547w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2625\" class=\"wp-caption-text\"><strong>Extra Variables in the Bindings List<\/strong><\/figcaption><\/figure>\n<p>Here are some examples with <em><strong>&#8220;_&#8221;<\/strong><\/em> in the binding list (not a common scenario):<\/p>\n<figure id=\"attachment_2626\" aria-describedby=\"caption-attachment-2626\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example6.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2626\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/example6-6\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example6.jpg\" data-orig-size=\"530,266\" 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;1638040703&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=\"Bindings List Contains &amp;#8220;_&amp;#8221;\" data-image-description=\"&lt;p&gt;Bindings List Contains &amp;#8220;_&amp;#8221;&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Bindings List Contains &amp;#8220;_&amp;#8221;&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example6.jpg\" class=\"wp-image-2626\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example6.jpg?resize=500%2C251&#038;ssl=1\" alt=\"Bindings List Contains &quot;_&quot;\" width=\"500\" height=\"251\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example6.jpg?resize=300%2C151&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example6.jpg?w=530&amp;ssl=1 530w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2626\" class=\"wp-caption-text\"><strong>Bindings List Contains &#8220;_&#8221;<\/strong><\/figcaption><\/figure>\n<p>The first fails because of inconsistent bindings. When the first two arguments unify, the bindings will be &#8216;((A 1) (B 2)). However, the third parameter forces &#8216;(A 10), which is different from &#8216;(A 1). This cannot be true and hence the unification fails.<\/p>\n<p>The remaining cases use <em><strong>&#8220;_&#8221;<\/strong><\/em> and hence there is no inconsistency. In the last case, the extra binding &#8216;(C _) is ignored because the variable <em><strong>&#8220;C&#8221;<\/strong><\/em> does not occur in the first two expressions and <em><strong>&#8220;_&#8221;<\/strong><\/em> is just a place holder with no concrete value.<\/p>\n<p>In practice, the third argument is often another <em><strong>&#8220;unify&#8221;<\/strong><\/em> expression, in which case, its result will be used as the binding list for the main\u00a0<em><strong>&#8220;unify&#8221;<\/strong><\/em>.<\/p>\n<figure id=\"attachment_2627\" aria-describedby=\"caption-attachment-2627\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example7.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2627\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/28\/understanding-the-unify-function-in-newlisp\/example7-5\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example7.jpg\" data-orig-size=\"826,121\" 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;1638041213&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=\"Nested &amp;#8220;unify&amp;#8221;\" data-image-description=\"&lt;p&gt;Nested &amp;#8220;unify&amp;#8221;&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Nested &amp;#8220;unify&amp;#8221;&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example7.jpg\" class=\"wp-image-2627\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example7.jpg?resize=550%2C81&#038;ssl=1\" alt=\"Nested &quot;unify&quot;\" width=\"550\" height=\"81\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example7.jpg?resize=300%2C44&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example7.jpg?resize=768%2C113&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example7.jpg?w=826&amp;ssl=1 826w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-2627\" class=\"wp-caption-text\"><strong>Nested &#8220;unify&#8221;<\/strong><\/figcaption><\/figure>\n<p>Do you see why the second case fails? It forces <em><strong>&#8220;P&#8221;<\/strong><\/em> and <em><strong>&#8220;Y&#8221;<\/strong><\/em> to take different bindings (due to the nested <em><strong>&#8220;unify&#8221;<\/strong><\/em>), and this cannot satisfy the unification of the first two expressions.<\/p>\n<p>I hope the functionality of <em><strong>&#8220;unify&#8221;<\/strong><\/em> in <em><strong>&#8220;newLisp&#8221;<\/strong><\/em> is reasonably clear from the discussion so far. Do check it out when you get time.<\/p>\n<p><em><strong>Have a wonderful Thanksgiving weekend!<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unification between two symbolic expressions involves finding substitutions for variables (if any) in the expressions such that the expressions match\u00a0after applying the substitutions. This is a powerful idea and is quite common in logic programming languages such as Prolog. Interestingly, &#8220;newLisp&#8221; has a buil-in function called &#8220;unify&#8221; that can be used for unifying two expressions. [&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_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},"jetpack_post_was_ever_published":false},"categories":[297,17],"tags":[148,300],"class_list":["post-2620","post","type-post","status-publish","format-standard","hentry","category-newlisp","category-programming","tag-prolog","tag-unification"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-Gg","jetpack-related-posts":[{"id":2632,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/12\/12\/the-net-eval-function-in-newlisp\/","url_meta":{"origin":2620,"position":0},"title":"The &#8220;net-eval&#8221; Function in &#8220;newLisp&#8221;","author":"admin","date":"December 12, 2021","format":false,"excerpt":"One of the cool\u00a0things about \"newLisp\" is that despite its small fooprint, it comes with a lot of functionality built-in. For instance, if you are interested in distributed computing, it is pretty easy to get started. In this article, I will touch upon the net-eval function\u00a0that allows an expression to\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Two Servers","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/12\/Servers-300x253.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2580,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/10\/17\/some-interesting-features-of-newlisp\/","url_meta":{"origin":2620,"position":1},"title":"Some Interesting Features of &#8220;newLisp&#8221;","author":"admin","date":"October 17, 2021","format":false,"excerpt":"newLisp is a general-purpose scripting language with a Lisp-like syntax. That is one of the reasons I wanted to take a closer look at the language. It has a compact footprint, small resource requirements, and can easily be embedded. It is available on multiple platforms, and on my Windows machine,\u2026","rel":"","context":"In &quot;newLisp&quot;","block_context":{"text":"newLisp","link":"https:\/\/www.rangakrish.com\/index.php\/category\/newlisp\/"},"img":{"alt_text":"\"amb\" Function","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/10\/example1.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2610,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/14\/currying-in-newlisp\/","url_meta":{"origin":2620,"position":2},"title":"Currying in &#8220;newLisp&#8221;","author":"admin","date":"November 14, 2021","format":false,"excerpt":"In the last two articles, I discussed what I believe are some interesting features of \"newLisp\". Today's topic is \"currying\", another useful feature. For those of you who are new to this topic, I had earlier written about \"currying\" in Mathematica here. You may want to take a look at\u2026","rel":"","context":"In &quot;newLisp&quot;","block_context":{"text":"newLisp","link":"https:\/\/www.rangakrish.com\/index.php\/category\/newlisp\/"},"img":{"alt_text":"Example of Currying","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/Example1-300x141.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2593,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/11\/01\/implicit-indexing-and-slicing-in-newlisp\/","url_meta":{"origin":2620,"position":3},"title":"Implicit Indexing and Slicing in &#8220;newLisp&#8221;","author":"admin","date":"November 1, 2021","format":false,"excerpt":"In traditional Lisp (Common Lisp), when evaluating an S-expression list, the first element in the \"functor\" position must be a function or valid operator. newLisp\u00a0relaxes this requirement and allows the first element to be a context symbol type, a list, an array, or an integer. For today's discussion, let us\u2026","rel":"","context":"In &quot;newLisp&quot;","block_context":{"text":"newLisp","link":"https:\/\/www.rangakrish.com\/index.php\/category\/newlisp\/"},"img":{"alt_text":"List Indexing","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/11\/list1-300x141.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3573,"url":"https:\/\/www.rangakrish.com\/index.php\/2024\/12\/17\/using-prolog-to-solve-the-word-transformation-puzzle\/","url_meta":{"origin":2620,"position":4},"title":"Using Prolog to Solve the Word Transformation Puzzle","author":"admin","date":"December 17, 2024","format":false,"excerpt":"In today\u2019s article, I want to share an interesting word puzzle, and then show how to solve it in Prolog. Here is the puzzle: You are given two words of the same length. You have to transform the first word into the second word, by changing only one letter at\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"Our Dictionary","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/12\/prolog1-300x280.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2922,"url":"https:\/\/www.rangakrish.com\/index.php\/2022\/10\/06\/why-learn-prolog\/","url_meta":{"origin":2620,"position":5},"title":"Why Learn Prolog?","author":"admin","date":"October 6, 2022","format":false,"excerpt":"There are several programming languages in use today and a simple google search will throw up interesting recommendations of a subset of these languages to learn, usually based on popularity ranking. As is expected, the popularity of a programming language varies over time and hence a language that was in\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2620","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=2620"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2620\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=2620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=2620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=2620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}