{"id":340,"date":"2008-09-17T14:03:14","date_gmt":"2008-09-17T21:03:14","guid":{"rendered":"https:\/\/dubinko.info\/blog\/?p=340"},"modified":"2008-09-17T14:03:14","modified_gmt":"2008-09-17T21:03:14","slug":"the-case-for-native-higher-order-functions-in-xquery","status":"publish","type":"post","link":"https:\/\/dubinko.info\/blog\/2008\/09\/the-case-for-native-higher-order-functions-in-xquery\/","title":{"rendered":"The case for native higher-order functions in XQuery"},"content":{"rendered":"<p>The XQuery Working Group is debating the need for higher-order functions in the language. I&#8217;m working on honing my description of why this is an important feature. Does this work? What would work better?<\/p>\n<p>Imagine you are writing a smallish widget app, in an environment without a standard library. When you need to sort your widgets, you&#8217;d write a simple function with a signature like sort(sequence-of-widgets). That&#8217;s great.<\/p>\n<p>Now imagine you find your app to be steadily growing. An accumulation of smaller one-off solutions won&#8217;t work anymore, you need a general solution. What you&#8217;ll end up with is something like <a href=\"http:\/\/www.cplusplus.com\/reference\/clibrary\/cstdlib\/qsort.html\">qsort<\/a> in C, which takes a pointer to a comparator function. By providing different comparators, you can sort anything any way you like, all through only a single sort function. C and C++ have something like this, as do PHP, Python, Java, JavaScript, and even assembly language. XSLT has it, as proven by <a href=\"http:\/\/fxsl.sourceforge.net\/\">Dimitre<\/a>.<\/p>\n<p>XQuery doesn&#8217;t. It should, because people are now using it for more than short queries. People are writing programs in it. -m<\/p>\n<p>P. S. Comment please.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The XQuery Working Group is debating the need for higher-order functions in the language. I&#8217;m working on honing my description of why this is an important feature. Does this work? What would work better? Imagine you are writing a smallish widget app, in an environment without a standard library. When you need to sort your&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[27,24,9,124],"tags":[364,363,366,134,293,365,251,1164,362,96],"class_list":["post-340","post","type-post","status-publish","format-standard","hentry","category-languages","category-python","category-standards","category-xquery-standards","tag-functional","tag-higherorder","tag-java","tag-javascript","tag-language","tag-php","tag-programming","tag-python","tag-qsort","tag-xquery"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8eo8l-5u","_links":{"self":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/comments?post=340"}],"version-history":[{"count":0,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/340\/revisions"}],"wp:attachment":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/media?parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/categories?post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/tags?post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}