{"title":"MutableArithmetics: An API for mutable operations","authors":"Benoît Legat","doi":"10.21105/jcon.00093","DOIUrl":null,"url":null,"abstract":"Arithmetic operations defined in Julia do not modify their arguments. However, in many situations, a variable represents an ac-cumulator that can be modified in-place to contain the result, e.g., when summing the elements of an array. Moreover, for types that support mutation, mutating the value may have a significant performance benefit over creating a new instance. This paper presents an interface that allows algorithms to exploit mutability in arithmetic operations in a generic manner.","PeriodicalId":443465,"journal":{"name":"JuliaCon Proceedings","volume":" 12","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-04-18","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"JuliaCon Proceedings","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.21105/jcon.00093","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Arithmetic operations defined in Julia do not modify their arguments. However, in many situations, a variable represents an ac-cumulator that can be modified in-place to contain the result, e.g., when summing the elements of an array. Moreover, for types that support mutation, mutating the value may have a significant performance benefit over creating a new instance. This paper presents an interface that allows algorithms to exploit mutability in arithmetic operations in a generic manner.