||Implementing Data-Flow Fusion DSL on Clojure
6 , 2016-03-24 , 法政大学大学院情報科学研究科
Abstract— This paper presents a new optimization tech-nique for programming language Clojure based on the stan-dard fusion technique that merges list operations into a simpliﬁed loop.Short-cut fusions, foldr/build fusion, and stream fusions are standard fusion techniques used in a functional programming.Moreover, a recent fusion technique proposed by Lippmeier.Data ﬂow fusion  can fuse loops containing several data consumers over stream operators on Haskell. However, this isonly for Haskell. Clojure’s transducers  are factory func-tions generating abstract list objects. The functions generated by them wait evaluation as a lazy evaluation partially.We introduce data-ﬂow fusion macros into Clojure as a dynamic typing mechanism and show the difference of data ﬂow fusion between that of Clojure and Haskell.We focus on Clojure which is a functional programming language with attracting features of dynamic typing, Lisp macros, partial lazy evaluation, and running on the Java Virtual Machine (JVM).Our macro compiles S-expression of Clojure to Clojure code and Java class ﬁle. Our ideas are implemented as a domain speciﬁc language, which has strong points of the pro-vision of a simple interface for loop fusion, and independence from the implementation of a Clojure Compiler.We discuss the advantages and disadvantages of data-ﬂow fusion macro from experimental results and adaptability of our macro.