{"id":3806,"date":"2024-09-07T18:26:09","date_gmt":"2024-09-07T18:26:09","guid":{"rendered":"https:\/\/workhouse.sweetdishy.com\/?p=3806"},"modified":"2024-09-07T18:26:09","modified_gmt":"2024-09-07T18:26:09","slug":"concatenation","status":"publish","type":"post","link":"https:\/\/workhouse.sweetdishy.com\/index.php\/2024\/09\/07\/concatenation\/","title":{"rendered":"Concatenation"},"content":{"rendered":"\n<p id=\"Arti00011919\">Concatenating two lists\u2019 means adding the elements of the second list after the first one. For example, if we have a list with elements [a,b,c,d] and another list with elements [e,f,g,h], then the concatenated list will have elements [a,b,c,d,e,f,g,h].<\/p>\n\n\n\n<p id=\"Arti00011920\">To implement list_concat predicate in Prolog, add the following lines in kb5.pl file and execute the instructions shown in Figure.<\/p>\n\n\n\n<p id=\"Arti00011921\">Remember that,<\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"Arti00011922\">\n<li><strong>list_concat()<\/strong>&nbsp;takes first list, second list, and the concatenated. There are two observations here.<\/li>\n\n\n\n<li>If the first list is empty, and second list is L, then the concatenated list will be L.<\/li>\n\n\n\n<li>If the first list is not empty, then [Head|Tail] of first list, concatenate Tail with second list recursively, and store into new list in the form, [Head|New List].<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/learning.oreilly.com\/api\/v2\/epubs\/urn:orm:book:9789357053778\/files\/images\/img_p579-2.png\" alt=\"images\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/learning.oreilly.com\/api\/v2\/epubs\/urn:orm:book:9789357053778\/files\/images\/img_p580-1.png\" alt=\"images\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Concatenating two lists\u2019 means adding the elements of the second list after the first one. For example, if we have a list with elements [a,b,c,d] and another list with elements [e,f,g,h], then the concatenated list will have elements [a,b,c,d,e,f,g,h]. To implement list_concat predicate in Prolog, add the following lines in kb5.pl file and execute the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3341,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[464],"tags":[],"class_list":["post-3806","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming-language-prolog"],"jetpack_featured_media_url":"https:\/\/workhouse.sweetdishy.com\/wp-content\/uploads\/2024\/08\/programming.png","_links":{"self":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/3806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/comments?post=3806"}],"version-history":[{"count":1,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/3806\/revisions"}],"predecessor-version":[{"id":3807,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/3806\/revisions\/3807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/media\/3341"}],"wp:attachment":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/media?parent=3806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/categories?post=3806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/tags?post=3806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}