{"id":1973,"date":"2015-02-16T09:07:40","date_gmt":"2015-02-16T09:07:40","guid":{"rendered":"http:\/\/www.dyalog.com\/blog\/?p=1973"},"modified":"2015-02-16T10:19:49","modified_gmt":"2015-02-16T10:19:49","slug":"foo-shmoo","status":"publish","type":"post","link":"https:\/\/www.dyalog.com\/blog\/2015\/02\/foo-shmoo\/","title":{"rendered":"Foo, Shmoo"},"content":{"rendered":"<p><em>&#8220;We do not realize what tremendous power the structure of an habitual language has. It is not an exaggeration to say that it enslaves us through the mechanism of s[emantic] r[eactions] and that the structure which a language exhibits, and impresses upon us unconsciously, is automatically projected upon the world around us.&#8221;<\/em><br \/>\n\u2014Korzybski (1930) in Science &amp; Sanity p. 90<\/p>\n<p>I\u2019m trying to train myself to choose\u00a0<em>nouns<\/em>\u00a0as names for my functions, in the hope that doing so will help to free me from the procedural mindset, which was pervasive when I learned to program. In those days, coding concentrated more or less exclusively on the manipulation of state and only rarely on the construction of definitions. In saying this, I&#8217;m distinguishing procedures, which legitimately deal in state, from functions, which don&#8217;t. Transitive verbs: <strong>print<\/strong>, <strong>init<\/strong>, <strong>reverse<\/strong>(vt), &#8230; make good names for procedures.<\/p>\n<p>Many of APL&#8217;s primitive monadic functions have nouns as names: <strong>floor<\/strong>, <strong>reciprocal<\/strong>, <strong>reverse<\/strong>(n), <strong>shape<\/strong>, \u2026<\/p>\n<p>Except this doesn&#8217;t quite work. Each of these names seems to need an &#8220;of&#8221; when applied to an argument, where the <em>of<\/em> seems to bind to the word that follows it:<\/p>\n<pre><code class=\"language-apl\">   \u230a\u00f7blah \u00a0\u00a0\u235d\u00a0\"floor of reciprocal of blah\"<\/code><\/pre>\n<p>I&#8217;ve seen dyadic iota documented as <strong>index-of<\/strong>, though this grates a bit as &#8220;index of&#8221; isn&#8217;t a noun phrase in English. In fact, as far as I know, all of the romance languages would parse\u00a0<em>Richard of York<\/em>\u00a0as\u00a0<em>Richard (of York)<\/em>, where\u00a0<em>(of York)<\/em>\u00a0is a noun phrase in the genitive case: <em>York&#8217;s Richard<\/em>; <em>Ricardus Eboracum<\/em>. Nobody seems to parse it\u00a0<em>(Richard of) York<\/em>.<\/p>\n<p>So much for that idea for a blog post; ho hum; back to real work.<\/p>\n<p>Then Nick Nickolov found a Wikipedia entry\u00a0that suggested:\u00a0<em>&#8220;Some languages, such as the Cariban languages, can be said to have a\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Possessive\" target=\"_blank\">possessed<\/a> case, used to indicate the other party (the thing possessed) in a possession relationship&#8221;<\/em>.\u00a0So the (Richard of) parsing would work in one of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cariban_languages\" target=\"_blank\">Cariban languages<\/a> and isn&#8217;t therefore a property of any deep structure of language, per se.<\/p>\n<p>Now when I see <strong>ceiling<\/strong>, I can still think of it as a noun, but in the possessed case. To emphasise this, for the rest of this posting, I&#8217;ll write my function names with a back-tick inflection to represent the case: <strong>reverse`<\/strong> meaning\u00a0<em>reverse-of<\/em>.<\/p>\n<pre><code class=\"language-apl\">   \u230a\u00f7blah \u00a0\u00a0\u235d\u00a0floor` reciprocal` blah<\/code><\/pre>\n<p>&#8230; and when reading my code, I can vocalise the ending with a slight [\u0259v] or [\u0259] sound as in &#8220;Land&#8217;v plenty&#8221;, &#8220;Bagguh chips, please&#8221;, &#8220;Floor&#8217;v reciprocal&#8217;v blah&#8221;.<\/p>\n<p>But what about dyadic functions? Glad you asked. The left argument of a function (arrays are naturally nouns) can be seen as a\u00a0<em>noun acting as determiner<\/em>, technically a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Noun_adjunct\" target=\"_blank\">noun adjunct<\/a>:\u00a0<em>coffee table<\/em>,\u00a0<em>bicycle thief<\/em>,\u00a0<em>cube root<\/em>, <em>noun adjunct<\/em>, \u2026 Thus: <strong>2-residue`<\/strong>, <strong>N-take`<\/strong>, <strong>zilde-reshape`<\/strong>,\u00a0<strong><code class=\"language-apl\">\u2395AV<\/code>-index`<\/strong>&#8230;<\/p>\n<p>Practising this discipline has been quite illuminating: it has pushed me towards left argument currying. I now mentally parse\u00a0<code class=\"language-apl\">\u00af2\u233dV<\/code>\u00a0as\u00a0<code class=\"language-apl\">(\u00af2\u233d)V<\/code>\u00a0the <em>((neg-two)-rotation`) V<\/em>,\u00a0where\u00a0<em>neg<\/em> qualifies\u00a0<em>two<\/em>, which in turn qualifies\u00a0<em>rotation`<\/em>.<\/p>\n<p>But surely\u00a0<code class=\"language-apl\">2+3<\/code> is just a symmetrical expression with respect to its arguments? Well yes, but we could also parse it as follows: Starting from the monadic\u00a0<strong>successor`<\/strong>\u00a0function\u00a0<code class=\"language-apl\">1\u2218+<\/code>, the curried dyadic version <code class=\"language-apl\">1+<\/code> would be the\u00a0<strong>one-successor`<\/strong>\u00a0and so\u00a0<code class=\"language-apl\">2+3<\/code> is the <em><strong>two-successor` three<\/strong><\/em>.<\/p>\n<p>Now, how should we incorporate operators and their operands into this scheme? &#8220;The <strong>reverse` each` V<\/strong>&#8220;, where <strong>each`<\/strong> is functioning as a <a href=\"https:\/\/en.wikipedia.org\/wiki\/English_determiners\" target=\"_blank\">determiner<\/a>?<\/p>\n<p><strong>PS:<\/strong> Choosing nouns for the <em>names<\/em> of functions shouldn&#8217;t be confused with J&#8217;s excellent taxonomy of language components using parts of speech, in which functions are <em>labelled<\/em> &#8220;verbs&#8221;.<\/p>\n<p><strong>PPS:<\/strong> Functions <strong>reverse`<\/strong>, <strong>successor`<\/strong>, <strong>shape`<\/strong>, &#8230; could also be seen as <em>properties<\/em> of their argument. A number N has many properties: its successor, its square-root, its floor, ceiling, prime-factorisation vector, &#8230; This is beginning to sound a bit like OO&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;We do not realize what tremendous power the structure of an habitual language has. It is not an exaggeration to say that it enslaves us through the mechanism of s[emantic] r[eactions] and that the structure which a language exhibits, and &hellip; <a href=\"https:\/\/www.dyalog.com\/blog\/2015\/02\/foo-shmoo\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,23],"tags":[],"class_list":["post-1973","post","type-post","status-publish","format-standard","hentry","category-apl-language","category-musings"],"_links":{"self":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/1973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/comments?post=1973"}],"version-history":[{"count":75,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/1973\/revisions"}],"predecessor-version":[{"id":2071,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/1973\/revisions\/2071"}],"wp:attachment":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/media?parent=1973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/categories?post=1973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/tags?post=1973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}