{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2025,2,26]],"date-time":"2025-02-26T05:34:36Z","timestamp":1740548076702,"version":"3.38.0"},"reference-count":39,"publisher":"Cambridge University Press (CUP)","license":[{"start":{"date-parts":[[2025,2,26]],"date-time":"2025-02-26T00:00:00Z","timestamp":1740528000000},"content-version":"unspecified","delay-in-days":56,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["cambridge.org"],"crossmark-restriction":true},"short-container-title":["J. Funct. Prog."],"published-print":{"date-parts":[[2025]]},"abstract":"<jats:title>Abstract<\/jats:title>\n\t  <jats:p>Experience in teaching functional programming (FP) on a relational basis has led the author to focus on a graphical style of expression and reasoning in which a geometric construct shines: the (semi) commutative square. In the classroom this is termed the \u201cmagic square\u201d (MS), since virtually everything that we do in logic, FP, database modeling, formal semantics and so on fits in some MS geometry. The sides of each magic square are binary relations and the square itself is a comparison of two paths, each involving two sides. MSs compose and have a number of useful properties. Among several examples given in the paper ranging over different application domains, <jats:italic>free-theorem<\/jats:italic> MSs are shown to be particularly elegant and productive. Helped by a little bit of Galois connections, a generic, induction-free theory for <jats:inline-formula>\n\t      <jats:alternatives>\n\t\t<jats:inline-graphic xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796825000012_inline1.png\"\/>\n\t\t<jats:tex-math>\n${\\mathsf{foldr}}$\n<\/jats:tex-math>\n\t      <\/jats:alternatives>\n\t    <\/jats:inline-formula> and <jats:inline-formula>\n\t      <jats:alternatives>\n\t\t<jats:inline-graphic xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796825000012_inline2.png\"\/>\n\t\t<jats:tex-math>\n$\\mathsf{foldl}$\n<\/jats:tex-math>\n\t      <\/jats:alternatives>\n\t    <\/jats:inline-formula> is given, showing in particular that <jats:inline-formula>\n\t      <jats:alternatives>\n\t\t<jats:inline-graphic xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796825000012_inline3.png\"\/>\n\t\t<jats:tex-math>\n${\\mathsf{foldl} \\, {{s}}{}\\mathrel{=}\\mathsf{foldr}{({flip} \\unicode{x005F}{s})}{}}$\n<\/jats:tex-math>\n\t      <\/jats:alternatives>\n\t    <\/jats:inline-formula> holds under conditions milder than usually advocated.<\/jats:p>","DOI":"10.1017\/s0956796825000012","type":"journal-article","created":{"date-parts":[[2025,2,26]],"date-time":"2025-02-26T03:33:31Z","timestamp":1740540811000},"update-policy":"https:\/\/doi.org\/10.1017\/policypage","source":"Crossref","is-referenced-by-count":0,"title":["How much is in a square? Calculating functional programs with squares"],"prefix":"10.1017","volume":"35","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-0196-4229","authenticated-orcid":false,"given":"JOSE NUNO","family":"OLIVEIRA","sequence":"first","affiliation":[]}],"member":"56","published-online":{"date-parts":[[2025,2,26]]},"reference":[{"key":"S0956796825000012_ref24","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-031-43345-0_2"},{"key":"S0956796825000012_ref23","unstructured":"Oliveira, J. N. (2020) A Note on the Under-Appreciated for-Loop. Technical Report TR-HASLab:01:2020 (pdf), HASLab\/U.Minho and INESC TEC."},{"key":"S0956796825000012_ref14","first-page":"2108","article-title":"Adjoint folds and unfolds \u2014 an extended study","volume":"78","author":"Hinze","year":"2013","journal-title":"SCP"},{"key":"S0956796825000012_ref20","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-21070-9_22"},{"key":"S0956796825000012_ref1","first-page":"153","article-title":"Safety of abstract interpretations for free, via logical relations and Galois connections","volume":"15","author":"Backhouse","year":"2004","journal-title":"SCP"},{"key":"S0956796825000012_ref32","doi-asserted-by":"publisher","DOI":"10.1145\/1480881.1480904"},{"key":"S0956796825000012_ref27","first-page":"85","author":"Plotkin","year":"2000"},{"key":"S0956796825000012_ref34","doi-asserted-by":"publisher","DOI":"10.1017\/S0960129598002540"},{"key":"S0956796825000012_ref12","doi-asserted-by":"publisher","DOI":"10.1145\/2034773.2034777"},{"key":"S0956796825000012_ref15","doi-asserted-by":"publisher","DOI":"10.1145\/2676726.2676989"},{"key":"S0956796825000012_ref18","doi-asserted-by":"publisher","DOI":"10.1145\/359460.359473"},{"key":"S0956796825000012_ref8","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796822000156"},{"key":"S0956796825000012_ref21","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2021.3117515"},{"key":"S0956796825000012_ref29","first-page":"298","volume-title":"In LICS","author":"Sangiorgi","year":"2004"},{"key":"S0956796825000012_ref35","doi-asserted-by":"crossref","unstructured":"Wadler, P. L. (1989) Theorems for free! In 4th International Symposium on Functional Programming Languages and Computer Architecture, London. ACM, pp. 347\u2013359.","DOI":"10.1145\/99370.99404"},{"key":"S0956796825000012_ref36","doi-asserted-by":"publisher","DOI":"10.1145\/91556.91592"},{"key":"S0956796825000012_ref31","doi-asserted-by":"publisher","DOI":"10.1090\/S0002-9939-1971-0274349-1"},{"key":"S0956796825000012_ref19","doi-asserted-by":"publisher","DOI":"10.1016\/0890-5401(91)90052-4"},{"key":"S0956796825000012_ref4","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-540-79980-1_7"},{"key":"S0956796825000012_ref30","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-03545-1_8"},{"key":"S0956796825000012_ref33","unstructured":"Voigtl\u00e4nder, J. (2019) Free theorems simply, via dinaturality. arXiv cs.PL 1908.07776."},{"key":"S0956796825000012_ref11","volume-title":"Mathematical Library","volume":"39","author":"Freyd","year":"1990"},{"key":"S0956796825000012_ref22","first-page":"195","volume-title":"LNCS","volume":"5520","author":"Oliveira","year":"2009"},{"key":"S0956796825000012_ref7","first-page":"207","volume-title":"Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages","author":"Damas","year":"1982"},{"key":"S0956796825000012_ref5","volume-title":"Algebra of Programming","author":"Bird","year":"1997"},{"key":"S0956796825000012_ref3","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-662-43352-2_11"},{"key":"S0956796825000012_ref6","doi-asserted-by":"publisher","DOI":"10.1017\/9781108869041"},{"key":"S0956796825000012_ref28","first-page":"513","article-title":"Types, abstraction and parametric polymorphism","volume":"83","author":"Reynolds","year":"1983","journal-title":"Inf. Process."},{"key":"S0956796825000012_ref13","doi-asserted-by":"crossref","unstructured":"Hackett, J. & Hutton, G. (2015) Programs for cheap! In LICS 2015. IEEE Computer Society, pp. 115\u2013126.","DOI":"10.1109\/LICS.2015.21"},{"key":"S0956796825000012_ref10","unstructured":"Dijkstra, E. W. (2001) Indirect Equality Enriched. Technical note EWD 1315-0."},{"key":"S0956796825000012_ref17","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2007.07.001"},{"key":"S0956796825000012_ref26","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2012.15"},{"key":"S0956796825000012_ref9","unstructured":"de Bakker, J. & de Roever, W. P. A Calculus for Recursive Program Schemes. Stichting Mathematisch Centrum Tec. Report 131\/72, Amsterdam. https:\/\/ir.cwi.nl\/pub\/9145, January 1972."},{"key":"S0956796825000012_ref39","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2018.2876433"},{"key":"S0956796825000012_ref25","unstructured":"Oliveira, J. N. (2024) Program Design by Calculation. Unpublished book draft, Sep. 2024. Informatics Dept., U.Minho (pdf)."},{"key":"S0956796825000012_ref37","doi-asserted-by":"publisher","DOI":"10.1145\/2699407"},{"key":"S0956796825000012_ref16","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796899003500"},{"key":"S0956796825000012_ref38","doi-asserted-by":"publisher","DOI":"10.1016\/0012-365X(84)90188-2"},{"key":"S0956796825000012_ref2","doi-asserted-by":"publisher","DOI":"10.1007\/978-1-4612-4476-9_2"}],"container-title":["Journal of Functional Programming"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.cambridge.org\/core\/services\/aop-cambridge-core\/content\/view\/S0956796825000012","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,2,26]],"date-time":"2025-02-26T03:33:37Z","timestamp":1740540817000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.cambridge.org\/core\/product\/identifier\/S0956796825000012\/type\/journal_article"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025]]},"references-count":39,"alternative-id":["S0956796825000012"],"URL":"https:\/\/doi.org\/10.1017\/s0956796825000012","relation":{},"ISSN":["0956-7968","1469-7653"],"issn-type":[{"value":"0956-7968","type":"print"},{"value":"1469-7653","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025]]},"assertion":[{"value":"\u00a9 The Author(s), 2025. Published by Cambridge University Press","name":"copyright","label":"Copyright","group":{"name":"copyright_and_licensing","label":"Copyright and Licensing"}},{"value":"This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https:\/\/creativecommons.org\/licenses\/by\/4.0\/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.","name":"license","label":"License","group":{"name":"copyright_and_licensing","label":"Copyright and Licensing"}},{"value":"This content has been made available to all.","name":"free","label":"Free to read"}],"article-number":"e7"}}