{"id":3812,"date":"2024-09-07T18:28:00","date_gmt":"2024-09-07T18:28:00","guid":{"rendered":"https:\/\/workhouse.sweetdishy.com\/?p=3812"},"modified":"2024-09-07T18:28:01","modified_gmt":"2024-09-07T18:28:01","slug":"reverse-operation","status":"publish","type":"post","link":"https:\/\/workhouse.sweetdishy.com\/index.php\/2024\/09\/07\/reverse-operation\/","title":{"rendered":"Reverse Operation"},"content":{"rendered":"\n<p id=\"Arti00011956\">The reverse operation arranges the items of a list in reverse order. For example, a list L = [a,b,c,d,e] when reversed will give output as [e,d,c,b,a]. To create a predicate, list_reverse(List, ReversedList), we must remember that,<\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"Arti00011957\">\n<li>If the input list is empty, then the reversed list will also be empty.<\/li>\n\n\n\n<li>In the input list, elements are organized as [Head|Tail], but in the reversed list, elements in the Tail are recursively concatenated with the Head.<\/li>\n<\/ul>\n\n\n\n<p id=\"Arti00011960\">Add the instructions to implement list_rev predicate in kb5.pl and check the execution in console as shown in figure.<\/p>\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_p581-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_p582-1.png\" alt=\"images\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The reverse operation arranges the items of a list in reverse order. For example, a list L = [a,b,c,d,e] when reversed will give output as [e,d,c,b,a]. To create a predicate, list_reverse(List, ReversedList), we must remember that, Add the instructions to implement list_rev predicate in kb5.pl and check the execution in console as shown in figure.<\/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-3812","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\/3812","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=3812"}],"version-history":[{"count":1,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/3812\/revisions"}],"predecessor-version":[{"id":3813,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/3812\/revisions\/3813"}],"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=3812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/categories?post=3812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/tags?post=3812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}