{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,9,30]],"date-time":"2026-09-30T09:59:47Z","timestamp":1790762387648,"version":"4.1.0"},"reference-count":59,"publisher":"Association for Computing Machinery (ACM)","issue":"ICFP","license":[{"start":{"date-parts":[[2023,8,30]],"date-time":"2023-08-30T00:00:00Z","timestamp":1693353600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2023,8,30]]},"abstract":"<jats:p>As functional programmers we always face a dilemma: should we write purely  \nfunctional code, or sacrifice purity for efficiency and resort to in-place  \nupdates? This paper identifies precisely when we can have the best of both  \nworlds: a wide class of purely functional programs can be executed safely using  \nin-place updates without requiring allocation, provided their arguments are not  \nshared elsewhere.<\/jats:p>\n          <jats:p>We describe a linear _fully in-place_ (FIP) calculus where we prove that we can  \nalways execute such functions in a way that requires no (de)allocation and uses  \nconstant stack space. Of course, such a calculus is only relevant if we can  \nexpress interesting algorithms; we provide numerous examples of in-place  \nfunctions on datastructures such as splay trees or finger trees, together with  \nin-place versions of merge sort and quick sort.<\/jats:p>\n          <jats:p>We also show how we can generically derive a map function over _any_ polynomial  \ndata type that is fully in-place. Finally, we have implemented the rules of the  \nFIP calculus in the Koka language. Using the Perceus reference counting garbage  \ncollection, this implementation dynamically executes FIP functions in-place  \nwhenever possible.<\/jats:p>","DOI":"10.1145\/3607840","type":"journal-article","created":{"date-parts":[[2023,8,31]],"date-time":"2023-08-31T17:40:31Z","timestamp":1693503631000},"page":"275-304","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":13,"title":["FP\u00b2: Fully in-Place Functional Programming"],"prefix":"10.1145","volume":"7","author":[{"ORCID":"https:\/\/orcid.org\/0000-0003-3538-9688","authenticated-orcid":false,"given":"Anton","family":"Lorenzen","sequence":"first","affiliation":[{"name":"University of Edinburgh, UK"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-1027-5430","authenticated-orcid":false,"given":"Daan","family":"Leijen","sequence":"additional","affiliation":[{"name":"Microsoft Research, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-0295-7944","authenticated-orcid":false,"given":"Wouter","family":"Swierstra","sequence":"additional","affiliation":[{"name":"Utrecht University, Netherlands"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2023,8,31]]},"reference":[{"key":"e_1_2_1_1_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-45927-8_4"},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796807006399"},{"key":"e_1_2_1_3_1","volume-title":"An exploration of the Bird-Meertens formalism","author":"Backhouse Roland C","unstructured":"Roland C Backhouse. 1988. An exploration of the Bird-Meertens formalism. University of Groningen, Department of Mathematics and Computing Science."},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/185009.185016"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1145\/181748.181750"},{"key":"e_1_2_1_6_1","doi-asserted-by":"publisher","DOI":"10.1007\/BFb0026821"},{"key":"e_1_2_1_7_1","doi-asserted-by":"publisher","unstructured":"Fr\u00e9d\u00e9ric Bour Basile Cl\u00e9ment and Gabriel Scherer. 2021. Tail Modulo Cons. Journe\u00e9es Francophones des Langages Applicatifs (JFLA) April https:\/\/doi.org\/10.48550\/arXiv.2102.09823 hal-03146495.","DOI":"10.48550\/arXiv.2102.09823"},{"key":"e_1_2_1_8_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-18317-5_20"},{"key":"e_1_2_1_9_1","unstructured":"Maurice Bruynooghe. 1986. Compile time garbage collection. Katholieke Universiteit Leuven. Departement Computerwetenschappen."},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.1145\/3406088.3409026"},{"key":"e_1_2_1_11_1","volume-title":"Introduction to algorithms","author":"Cormen Thomas H","unstructured":"Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, and Clifford Stein. 2022. Introduction to algorithms. MIT press."},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-04652-0_3"},{"key":"e_1_2_1_13_1","doi-asserted-by":"publisher","DOI":"10.3233\/FI-222106"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-540-85373-2_12"},{"key":"e_1_2_1_15_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-57840-4_34"},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1145\/155090.155113"},{"key":"e_1_2_1_17_1","unstructured":"Jeremy Gibbons. 1994. An Introduction to the Bird- Meertens Formalism."},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.2307\/1995158"},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796805005769"},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/1926385.1926427"},{"key":"e_1_2_1_21_1","unstructured":"Martin Hofmann. 2000. In-place update with linear types or how to compile functional programms into malloc-free C. Preprint www.dcs.ed.ac.uk\/ mxh\/malloc.ps.gz"},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-46425-5_11"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1016\/S0890-5401(03)00009-9"},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/604131.604148"},{"key":"e_1_2_1_25_1","doi-asserted-by":"publisher","DOI":"10.1007\/11693024_3"},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/319838.319876"},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1145\/318593.318660"},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.1017\/s0956796897002864"},{"key":"e_1_2_1_29_1","doi-asserted-by":"publisher","DOI":"10.1016\/0020-0190(86)90059-1"},{"key":"e_1_2_1_30_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-28869-2_19"},{"key":"e_1_2_1_31_1","unstructured":"Daan Leijen. 2021. The Koka Language. https:\/\/koka-lang.github.io"},{"key":"e_1_2_1_32_1","doi-asserted-by":"publisher","DOI":"10.1145\/3571233"},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-34175-6_13"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/319838.319855"},{"key":"e_1_2_1_35_1","doi-asserted-by":"publisher","DOI":"10.1007\/11823230_17"},{"key":"e_1_2_1_36_1","doi-asserted-by":"publisher","DOI":"10.1145\/3547634"},{"key":"e_1_2_1_37_1","doi-asserted-by":"crossref","unstructured":"Anton Lorenzen Daan Leijen and Wouter Swierstra. 2023. FP ^2: Fully in-Place Functional Programming. Microsoft Research.","DOI":"10.1145\/3607840"},{"key":"e_1_2_1_38_1","doi-asserted-by":"publisher","unstructured":"Anton Lorenzen Daan Leijen and Wouter Swierstra. 2023. FP^2: Fully in-Place Functional Programming Artifact. https:\/\/doi.org\/10.5281\/zenodo.7988150 Artifact for ICFP\u201923. 10.5281\/zenodo.7988150","DOI":"10.5281\/zenodo.7988150"},{"key":"e_1_2_1_39_1","doi-asserted-by":"publisher","DOI":"10.1145\/3498672"},{"key":"e_1_2_1_40_1","unstructured":"Conor McBride. 2001. The derivative of a regular type is its type of one-hole contexts. Unpublished manuscript 74\u201388."},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","DOI":"10.1145\/1328438.1328474"},{"key":"e_1_2_1_42_1","doi-asserted-by":"publisher","DOI":"10.1016\/0022-0000(78)90014-4"},{"key":"e_1_2_1_43_1","doi-asserted-by":"publisher","DOI":"10.1145\/3571218"},{"key":"e_1_2_1_44_1","doi-asserted-by":"publisher","DOI":"10.1017\/s0956796899003494"},{"key":"e_1_2_1_45_1","doi-asserted-by":"publisher","DOI":"10.1007\/3540543961_30"},{"key":"e_1_2_1_46_1","doi-asserted-by":"publisher","DOI":"10.1145\/3453483.3454032"},{"key":"e_1_2_1_47_1","doi-asserted-by":"publisher","DOI":"10.1145\/800194.805852"},{"key":"e_1_2_1_48_1","doi-asserted-by":"publisher","DOI":"10.1109\/LICS.2002.1029817"},{"key":"e_1_2_1_49_1","volume-title":"Proceedings of IFL. 94","author":"Scholz Sven-Bodo","year":"1994","unstructured":"Sven-Bodo Scholz. 1994. Single assignment C-Functional programming using imperative style. In Proceedings of IFL. 94."},{"key":"e_1_2_1_50_1","doi-asserted-by":"publisher","DOI":"10.1145\/363534.363554"},{"key":"e_1_2_1_51_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-58402-1_9"},{"key":"e_1_2_1_52_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-1-4471-3794-8_16"},{"key":"e_1_2_1_53_1","doi-asserted-by":"publisher","DOI":"10.1145\/3828.3835"},{"key":"e_1_2_1_54_1","doi-asserted-by":"publisher","DOI":"10.1145\/289423.289452"},{"key":"e_1_2_1_55_1","doi-asserted-by":"publisher","DOI":"10.1145\/800055.802032"},{"key":"e_1_2_1_56_1","doi-asserted-by":"publisher","DOI":"10.1145\/3412932.3412935"},{"key":"e_1_2_1_57_1","unstructured":"Twan van Laarhoven. 2007. Deriving Functor. https:\/\/mail.haskell.org\/pipermail\/haskell-prime\/2007-March\/002137.html"},{"key":"e_1_2_1_58_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-45332-6_7"},{"key":"e_1_2_1_59_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.tcs.2006.12.036"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3607840","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3607840","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T16:37:06Z","timestamp":1750178226000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3607840"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2023,8,30]]},"references-count":59,"journal-issue":{"issue":"ICFP","published-print":{"date-parts":[[2023,8,30]]}},"alternative-id":["10.1145\/3607840"],"URL":"https:\/\/doi.org\/10.1145\/3607840","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2023,8,30]]},"assertion":[{"value":"2023-08-31","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}