Technical Report
Total Page:16
File Type:pdf, Size:1020Kb
Technical Report Proceedings of the 2020 Scheme and Functional Programming Workshop Edited by Baptiste Saleil and Michael D. Adams arXiv:2101.06759v1 [cs.PL] 17 Jan 2021 January 2021 Computer Science and Engineering technical reports published by University of Michigan are available at: https:// cse.engin.umich.edu/ research/ technical-reports-publications/ Preface This report aggregates the papers presented at the twenty-first annual Scheme and Func- tional Programming Workshop, hosted on August 28th, 2020, online and co-located with the twenty-fifth International Conference on Functional Programming. The Scheme and Func- tional Programming Workshop is held every year to provide an opportunity for researchers and practitioners using Scheme and related functional programming languages like Racket, Clojure, and Lisp, to share research findings and discuss the future of the Scheme program- ming language. Seven papers and three lightning talks were submitted to the workshop, and each submission was reviewed by three members of the program committee. After deliber- ation, four papers and three lightning talks were accepted to the workshop. In addition to the four papers and three lightning talks presented, • Martin Henz and Tobias Wrigstad gave an invited keynote speech entitled SICP JS: Ketchup on Caviar? • Bohdan Khomtchouk and Jonah Fleishhacker gave an invited keynote speech entitled 21st Century Lisp in Academic Research and Pedagogy. Thank you to all the presenters, panelists, participants, and members of the program com- mittee. Program Committee Michael D. Adams, University of Michigan (Program Co-Chair) Baptiste Saleil, IBM Canada (Program Co-Chair) Maxime Chevalier-Boisvert, Universit´ede Montr´eal Ryan Culpepper, Czech Technical University Kimball Germane, University of Utah Yukiyoshi Kameyama, University of Tsukuba Andy Keep, Cisco Systems, Inc Julien Pag`es,Universit´ede Montr´eal Alexey Radul, Massachusetts Institute of Technology Steering Committee Will Byrd, University of Alabama at Birmingham Will Clinger, Northeastern University Marc Feeley, Universit´ede Montr´eal Dan Friedman, Indiana University Olin Shivers, Northeastern University Scheme and Functional Programming Workshop 2020 ii Scheme and Functional Programming Workshop 2020 iii Contents Keynote: SICP JS: Ketchup on Caviar? . .1 Keynote: 21st Century Lisp in Academic Research and Pedagogy . .2 Paper: Clotho: A Racket Library for Parametric Randomness . .3 Paper: Solving SICP: An Experience Report on Solving the World's Most Famous Programming Problem Set . 14 Paper: Running Scheme On Bare Metal (Experience Report) . 51 Paper: Scheme for Scientific Computing . 66 Talk: On Teaching Type Systems as Macros . 77 Talk: Designing a Programming Environment Based on the Program Design Recipe 78 Talk: Programming with Petri Nets to Reason about Concurrency . 79 Scheme and Functional Programming Workshop 2020 iv Keynote - SICP JS: Ketchup on Caviar? SICP JS: Ketchup on Caviar? Martin Henz Tobias Wrigstad National University of Singapore Uppsala University [email protected] [email protected] With its minimalism, the language Scheme is well suited, if controller instructions in chapter 5 of SICP JS enjoy a syntax not designed, for teaching the structure and interpretation similar to SICP, through the use of constructors, which fit of computer programs (SICP) to freshmen computer science naturally into section 5.2.3. On the negative side, the lack of students, and Harold Abelson and Gerald Jay Sussman made macros and our restriction to a JavaScript-compatible parser use of the language in their eponymous book, whose second required significant changes to and occasionally replacement edition was published in 1996. The presenters applied the of exercises in chapter 4. same minimalism to JavaScript, by identifying four sublan- The audience is welcome to inspect SICP JS by visiting guages just expressive enough for the first four chapters of https://source-academy.github.io/sicp. A comparison edition SICP, and named the languages Source §1, 2, 3 and 4. (There lets the reader inspect the changes and compare them line- turned out to be no need for a sublanguage for chapter 5 by-line with the original. The presentation will leave ample of SICP.) Due to changes introduced to JavaScript with EC- time for discussion. MAScript 2015, the Source languages are similar enough to The presentation will also cover the Source Academy, an Scheme for a relatively close adaptation of SICP to JavaScript. online learning environment for programming, developed The resulting book by Abelson and Sussman as original au- by and for students at the National University of Singapore, thors, and by the presenters as adapters, is available online, which implements the four Source languages along with including a side-by-side comparison. several variants and extensions introduced in SICP. We encountered the following issues during the adapta- tion due to the differences between the Source languages and Scheme, and briefly sketch here how they are resolved in SICP JS. The distinction between statements and expressions, and the use of return is probably the most significant change from SICP to SICP JS. A notable consequence is the need to wrap return values in data structures in 4.1.1 and 4.1.3 in order to distinguish x => { return x; } from x => { x; } the latter of which returns undefined in JavaScript. We faith- fully implement JavaScript’s return statements in chapters 4 and 5, such that control can return to the caller from any- where in the function body. This leads to several significant changes in these chapters, compared to the original. As a benefit, SICP JS helps readers understand statement-oriented languages such as Java and Python better. Both Scheme and JavaScript (in strict mode, introduced in ECMAScript 5) employ lexical scoping. The Source lan- guages only use JavaScript’s const and let (introduced in ECMAScript 2015) and avoid JavaScript’s var. The treatment of the scope of variables in chapter 4 and 5 becomes more uniform in SICP JS compared to SICP, as a result of consis- tently applying a treatment of const and let akin to Scheme’s derived expression letrec. The absence of Scheme’s homoiconicity might at the sur- face be considered a major obstacle to adapting SICP to lan- guages with a conventional syntax. However, SICP already hides the concrete syntax of programs behind an abstraction layer, which greatly simplifies the JavaScript adaptation. The introduction of an explicit parser suffices for adapting chap- ter 4 (including section 4.4 on logic programming), and the Scheme and Functional Programming Workshop 2020 1 Keynote - 21st Century Lisp in Academic Research and Pedagogy 21st Century Lisp in Academic Research and Pedagogy Bohdan Khomtchouk Jonah Fleishhacker University of Chicago University of Chicago [email protected] [email protected] Lisp-family languages (LFLs) continue to influence and in- pedagogy, particularly in introductory computer science and form modern programming language design and applica- functional programming courses. We present an educational tions. In bioinformatics and computational biology, LFLs perspective on beginning one’s journey in computer science have successfully been applied to high-performance com- with LFLs, and the advantages unique to this pedagogical puting, database curation, systems biology, drug discovery, approach. Distinct advantages of using LFLs for students can computational chemistry and nanotechnology, among much be found in fundamental theoretical concepts of computer more. Furthermore, dialects such as Racket, with its language- science and functional programming, along with practical oriented programming and streamlined development envi- software development in industry settings. ronment, or Clojure, with its Java ecosystem and comprehen- sive open-source libraries, present exciting possibilities in Scheme and Functional Programming Workshop 2020 2 Paper - Clotho: A Racket Library for Parametric Randomness Clotho: A Racket Library for Parametric Randomness Pierce Darragh William Gallard Hatch Eric Eide [email protected] [email protected] [email protected] University of Utah University of Utah University of Utah Salt Lake City, UT, USA Salt Lake City, UT, USA Salt Lake City, UT, USA Abstract Many mainstream programming languages only provide Programs such as simulators and fuzz testers often use ran- very simple randomness primitives and leave the more com- domness to walk through a large state space in search of plex uses of these functions up to developers to implement interesting paths or outcomes. These explorations can be on a per-case basis. This can be tedious and is prone to error. made more efficient by employing heuristics that “zero-in” While working on a random program generator (§2.1), we on paths through the state space that are more likely to lead found ourselves in need of a system for manipulating the to interesting solutions. Given one path that exhibits a de- outcomes of randomness functions in a predictable manner. sired property, it may be beneficial to generate and explore We wanted to “record” a sequence of randomly generated similar paths to determine if they produce similarly interest- values, modify that sequence in some way, and then feed ing results. When the random decisions made during this the modified recording back to our system to get a new—but path exploration can be manipulated in such a way that they similar—sequence of randomly generated values. Crucially, correspond