Indexing Common Lisp with Kythe a Demonstration Jonathan Godbout [email protected]

Total Page:16

File Type:pdf, Size:1020Kb

Indexing Common Lisp with Kythe a Demonstration Jonathan Godbout Jgodbout@Google.Com Indexing Common Lisp with Kythe A Demonstration Jonathan Godbout [email protected] ABSTRACT give other information about the indexed code. It has VNames which For decades Lispers have had the power of code cross-references uniquely identify a node in a code base. It has Edges which annotate (jump to definition, list callers, etc.) for any code they’ve loaded into how two nodes relate to each other. their Lisp image. But what about cross referencing code that isn’t For example, take the variable object from threadp in Bordeaux- (or can’t be) loaded into the image? Wouldn’t it be great if we could threads [7]: ask “who, in the global Lisp community, calls this function?” The (defun threadp (object) only option currently available is to download all Lisp code and use (typep object 'sb-thread:thread)) “grep” or similar text-based tools. At Google we use Kythe [4] as a The variable object next to threadp would have a node: cross-reference database for all Lisp code, whether loaded into our local Lisp image or not. We will show how Lisp is cross-referenced { on a static web-page with hyperlinks between definitions. With ticket: "kythe://corpus??lang=lisp?path=PATH this we can also get call graphs and call hierarchies 1. #BORDEAUX-THREADS%3A%3AOBJECT%20%3AVARIABLE %20loc%3D%2825%3A16-25%3A22%29", ACM Reference Format: Jonathan Godbout. 2020. Indexing Common Lisp with Kythe: A Demonstra- kind: "variable", tion. In Proceedings of the 13th European Lisp Symposium (ELS’20). ACM, language: "lisp", New York, NY, USA, 3 pages. https://doi.org/10.5281/zenodo.3765987 name: "object", qualified_name: "object", 1 INTRODUCTION location: { corpus: "corpus", Almost every software project will have a large number of files path: "PATH/TO/bordeaux-threads and functions. As soon as the number of files goes above 1, or /src/impl-sbcl.lisp", the number of possible on-screen pages goes above 1, users will line_number: 25, get confused about what definitions are used where. SLIME [5] line_number_end: 25, has jump-to-definition using “M-.”, so when the code has been column_number: 16, loaded into the Lisp image we can jump to function definitions column_number_end: 22 and call sites. On websites with static code, such as https://www. }, github.com, where the code is viewed statically on screen, it would v_name: { be nice to get hyperlinks between the definitions and their usage. signature: Kythe https://kythe.io/ is a service that allows users to implement "BORDEAUX-THREADS::OBJECT :VARIABLE loc=(25:16-25:22)", language-specific indexers and then to upload graphs describing corpus: "corpus", the structure of the code. This allows for code display and editing path: engines to provide services like jump-to-definition. At Google we "PATH/TO/bordeaux-threads/src/impl-sbcl.lisp", have implemented a Lisp plugin for the Kythe indexer to produce language: "lisp" cross reference data for Google’s Common Lisp code base. We will } start with a brief overview of Kythe, and then discuss indexing Lisp. } 2 KYTHE OVERVIEW The VName uniquely identifies the node. The slot kind tells which Kythe is a database for storing code graphs for large code bases kind of node this is, so “variable” tells us this is a variable. The slot across multiple languages. Its schema is designed to accommodate location tells us where the source location of the referenced code. facets of different languages. Part of its schema are nodes which The slot ticket is just a URI encoding of the VName. By location name functions and variables, define exact locations in a file, or reference we mean a node containing the location of a form in the code. 1some limitations apply There would be a second node for the instance of the variable which is the first argument to typep. Finally there would be an Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed edge for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. { For all other uses, contact the owner/author(s). source: node1, ELS’20, April 27–28 2020, Zürich, Switzerland target: node2, © 2020 Copyright held by the owner/author(s). ACM ISBN 978-x-xxxx-xxxx-x/YY/MM. edge_kind: ref https://doi.org/10.5281/zenodo.3765987 } ELS’20, April 27–28 2020, Zürich, Switzerland Jonathan Godbout (setf (bear-cat my-bear-cat) 'friendly)) We would like a reference from the bear-cat setter to the cat slot in the bear structure. In (most) Lisps, this would be fine, we would just add a call to who-calls for (setf bear-cat), but the Lisp language specification does not require such a function to exist. In fact SBCL does not create setf functions for structure-objects, so we must start by going through the code and creating location references for all structure-object accessors. 4 INTER-LANGUAGE REFERENCES Figure 1: Kythe Calling the Lisp Indexer We often make calls from one language into another language, for example Lisp’s foreign functions calls into C. At Google, the most common format for data interchange between systems is called node1 node2 where and are the first and second nodes discussed Protocol Buffers [2], or protobuf for short. A protobuf is a data above. interchange format that a language can implement. For full details on Kythe’s schema please reference https://kythe. To implement support for protobuf messages languages can use io/docs/schema/. their native structures but they must serialize the messages into a standard format before sending them out. Then any other language 3 STRATEGY that implements the protobuf standard can deserialize and read the In an out-of-band process, we start up a Lisp indexing service, messages. The content of the messages can be deserialized without and have it load all the code required to populate the who-calls knowledge of the protobuf schema used, but a protobuf schema database with the requisite information. This is essentially how detailing types and names are required for human readable output. SLIME determines jump-to-definition targets (along with some Here is an example protobuf schema defining one “message” (a heuristics needed for problems discussed later). structure) that contains a string: You may have: syntax = "proto2"; foo.lisp uses bar.lisp package example; The Lisp indexing plugin loads bar.lisp and foo.lisp into the Lisp image and the Lisp implementation determines the cross-reference message HelloWorld { information locally. If you are trying to create all cross-references optional string hello_world_string = 1; for foo.lisp and bar is a function defined in bar.lisp we can inspect } the who-calls database to get this cross-reference. In SBCL [3] you get all of the top level defun and defvar forms, Below we have lisp code that creates the Lisp standard-object but none of the top level forms that don’t define a data structure corresponding to the structure. that are needed later. For example, code that is run at start-up (let ((my-proto time, such as (setf *foo* ’foo), at the top level may not have a (make-instance 'example:hello-world cross reference in the who-calls database because the compiler can :hello-world-string ``hello-world''))) compile the call away. We will go through some examples:. (print (hello-world-string my-proto))) Local variable bindings aren’t stored in the who-calls database. We would like a reference from “hello-world-string” in the If you have a function Lisp code to the “hello_world_string” in the protobuf schema. (defun print-a (a) As Kythe is just a database service that stores a graph of the code (print a)) for contextualization in a language agnostic form, so long as you you would like to have a cross-reference from the a in print- know the signature for the “hello_world_string” you can just a’s lambda list to its use in the function’s body. This is not stored create a cross-reference in Kythe. in the who-calls database. To solve cases such as this we have a number of parsers (e.g. “defun” parser) that will get the symbols 5 MACROS to be bound and store their location. Iterating through all of the The use of a small number of parsers to understand local bindings code, with the correct set of parsers, will give us all of the local is not ideal but it is doable for the built in commands. In contrast definitions. Currently our parser is only a decent heuristic, andour Common Lisp is known for its powerful syntax-extending ability, method parser does not correctly cross-reference types. namely macros. For a detailed look at macros please consut Let Next we have hidden parameters that don’t show up in the code Over Lambda [6], we will go over a basic examples below. or the who-calls database. Take for example: (defvar *process-data-mutex* (make-mutex)) (defstruct bear cat) (defmacro with-data-mutex ((mutex) &body body) (defun set-bear-cat-friendly (my-bear-cat) `(let ((,mutex *process-data-mutex*)) ... lots of code ... (sb-thread:get-mutex ,mutex) Indexing Common Lisp with Kythe ELS’20, April 27–28 2020, Zürich, Switzerland ,@body REFERENCES (sb-thread:release-mutex ,mutex))) [1] Armed bear common lisp. https://abcl.org/. [2] Protocol buffers. https://developers.google.com/protocol-buffers. Accessed: 2020- 02-10. (defun process-data (data) [3] Steel bank common lisp.
Recommended publications
  • How Lisp Systems Look Different in Proceedings of European Conference on Software Maintenance and Reengineering (CSMR 2008)
    How Lisp Systems Look Different In Proceedings of European Conference on Software Maintenance and Reengineering (CSMR 2008) Adrian Dozsa Tudor Gˆırba Radu Marinescu Politehnica University of Timis¸oara University of Berne Politehnica University of Timis¸oara Romania Switzerland Romania [email protected] [email protected] [email protected] Abstract rently used in a variety of domains, like bio-informatics (BioBike), data mining (PEPITe), knowledge-based en- Many reverse engineering approaches have been devel- gineering (Cycorp or Genworks), video games (Naughty oped to analyze software systems written in different lan- Dog), flight scheduling (ITA Software), natural language guages like C/C++ or Java. These approaches typically processing (SRI International), CAD (ICAD or OneSpace), rely on a meta-model, that is either specific for the language financial applications (American Express), web program- at hand or language independent (e.g. UML). However, one ming (Yahoo! Store or reddit.com), telecom (AT&T, British language that was hardly addressed is Lisp. While at first Telecom Labs or France Telecom R&D), electronic design sight it can be accommodated by current language inde- automation (AMD or American Microsystems) or planning pendent meta-models, Lisp has some unique features (e.g. systems (NASA’s Mars Pathfinder spacecraft mission) [16]. macros, CLOS entities) that are crucial for reverse engi- neering Lisp systems. In this paper we propose a suite of Why Lisp is Different. In spite of its almost fifty-year new visualizations that reveal the special traits of the Lisp history, and of the fact that other programming languages language and thus help in understanding complex Lisp sys- borrowed concepts from it, Lisp still presents some unique tems.
    [Show full text]
  • Download This Ebook for Free
    lisp #lisp Table of Contents About 1 Chapter 1: Getting started with lisp 2 Remarks 2 Examples 2 Installation or Setup 2 Dialects of Lisp and their implementations 2 Lisp Resources 3 Credits 4 About You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: lisp It is an unofficial and free lisp ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official lisp. The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners. Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to [email protected] https://riptutorial.com/ 1 Chapter 1: Getting started with lisp Remarks This section provides an overview of what lisp is, and why a developer might want to use it. It should also mention any large subjects within lisp, and link out to the related topics. Since the Documentation for lisp is new, you may need to create initial versions of those related topics. Examples Installation or Setup Probably the two most popular free implementations of Common Lisp are Clozure Common Lisp (CCL) and Steel Bank Common Lisp (SBCL).
    [Show full text]
  • CSC 407/507 Programming Assignment #1: Common Lisp Due Date: Friday, February 2
    CSC 407/507 Programming Assignment #1: Common Lisp Due Date: Friday, February 2 Remember you can work in groups of up to three students. Download a version of Common Lisp. Two free (but trial limited) versions are available at Franz Common Lisp (http://www.franz.com/downloads/) and LispWorks (http://www.lispworks.com/). Another version is called Steel Bank Common Lisp which does not come with an IDE, just a command line interface (https://common-lisp.net/downloads/). A GNU’s Common Lisp is available for both Unix/Linux (https://www.gnu.org/software/gcl/) and Windows (https://www.cs.utexas.edu/users/novak/gclwin.html). LispWorks is recommended as the easiest and least fuss. In this program, you will write multiple Lisp functions which support (or implement wholly) sorting algorithms. Some functions may serve multiple sort algorithms if you can work it out although this is not necessary. You should aim to build helper functions so that you are not implementing any single sort in a single function. Some algorithms will require helper functions (e.g., mergesort which has at least the recursive mergesort function and the merge function). You are to implement five of the following seven sort algorithms: bubblesort, heapsort, insertionsort, mergesort, quicksort, radixsort and selectionsort. You must do at least one of mergesort or quicksort among the five you implement. You are to use recursion for the mergesort/quicksort functions and are encouraged to use recursion as much as possible in the remainder of your functions whether they are helper functions or the sort functions. Use lists to store the values to be sorted (they will all be integer numbers) rather than arrays.
    [Show full text]
  • Common Lisp Alan Dipert, [email protected] Orange Combinator 2018-12-17 Lisp History
    Old-School FP Common Lisp Alan Dipert, [email protected] Orange Combinator 2018-12-17 Lisp History Invented by John McCarthy at MIT in 1958 Inspired by Alonzo Church’s lambda calculus Described in 1960 paper, Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I Shows a Turing-complete language for algorithms and defines it in terms of an eval function written in itself Implemented by Steve Russell around 1960 A student of McCarthy’s, Russell saw McCarthy’s paper on his desk, read it, and implemented the eval function in machine code. The result was a Lisp interpreter. Language represented with its own data structures: homoiconicity Lambda Calculus Lisp (λx.M) (lambda (x) M…) Lambda abstraction Anonymous function M is any lambda term M… is zero or more expressions β-reduction Evaluation ((λx.M) E) → (M[x:=E]) ((lambda (x) M…) E) → (M[x:=E]) Relationship to AI Associated with Artificial Intelligence (AI) research since its invention at the MIT AI Lab by McCarthy in 1958 First symbolic programming language As opposed to numeric like Fortran (1957) Objects and operations upon them not necessarily numeric Logical Set-theoretic First garbage-collected language Memory reclaimed automatically when possible Really they just needed a decent scripting language to iterate quickly with Today, most programming is “symbolic”! Classic Lisp: member* (defun member* (x xs) (if xs (if (eql (car xs) x) xs (member* x (cdr xs))))) (member* 2 ‘(1 2 3)) → ‘(2 3) defun: defines a function in the current
    [Show full text]
  • A Quick Introduction to Common Lisp
    CSC 244/444 Notes last updated Feb 3, 2020 A Quick Introduction to Common Lisp Lisp is a functional language well-suited to sym- bolic AI, based on the λ-calculus and with list structures as a very flexible basic data type; pro- grams are themselves list structures, and thus can be created and manipulated just like other data. This introduction isn't intended to give you all the details, but just enough to get across the essential ideas, and to let you get under way quickly. The best way to make use of it is in front of a computer, trying out all the things mentioned. Basic characteristics of Lisp and Common Lisp: • Lisp is primarily intended for manipulating symbolic data in the form of list struc- tures, e.g., (THREE (BLIND MICE) SEE (HOW (THEY RUN)) !) • Arithmetic is included, e.g., (SQRT (+ (* 3 3) (* 4 4))) or (sqrt (+ (* 3 3) (* 4 4))) (Common Lisp is case-insensitive, except in strings between quotes " ... ", specially delimited symbols like |Very Unusual Symbol!|, and for characters prefixed with \\"). • Common Lisp (unlike John McCarthy's original \pure" Lisp) has arrays and record structures; this leads to more understandable and efficient code, much as in typed languages, but there is no obligatory typing. • All computation consists of expression evaluation. For instance, typing in the above (SQRT ...) expression and hitting the enter key immediately gives 5. • Lisp is a functional language based on Alonzo Church's λ-calculus (which like Turing machines provides a complete basis for all computable functions). For instance, a function for the square root of the sum of two squares can be expressed as (lambda (x y) (sqrt (+ (* x x) (* y y)))).
    [Show full text]
  • Il Ne Voyageait Pas, Il Décrivait Une Circonférence. C'était Un
    Il ne voyageait pas, il décrivait une circonférence. C’était un corps grave, parcourant une orbite autour du globe terrestre, suivant les lois de la méchanique rationelle. – Jules Verne The mind is its own place and in itself, can make a Heaven of Hell, a Hell of Heaven. – John Milton University of Alberta Automated Planning and Player Modelling for Interactive Storytelling by Alejandro Ramirez Sanabria A thesis submitted to the Faculty of Graduate Studies and Research in partial fulfillment of the requirements for the degree of Master of Science Department of Computing Science c Alejandro Ramirez Sanabria Fall 2013 Edmonton, Alberta Permission is hereby granted to the University of Alberta Libraries to reproduce single copies of this thesis and to lend or sell such copies for private, scholarly or scientific research purposes only. Where the thesis is converted to, or otherwise made available in digital form, the University of Alberta will advise potential users of the thesis of these terms. The author reserves all other publication and other rights in association with the copyright in the thesis and, except as herein before provided, neither the thesis nor any substantial portion thereof may be printed or otherwise reproduced in any material form whatsoever without the author’s prior written permission. To Fran, my family, and my closest friends: words have not yet been crafted to express the feelings of admiration and gratitude I hold dear in my heart for you. Abstract Interactive Storytelling (IS) acknowledges that people want to be participants in the unfolding of a story plot. Given the complex nature of IS, Artificial Intelligence (AI) methods can be called upon to improve and enhance interactive stories in video games.
    [Show full text]
  • 9 European Lisp Symposium
    Proceedings of the 9th European Lisp Symposium AGH University of Science and Technology, Kraków, Poland May 9 – 10, 2016 Irène Durand (ed.) ISBN-13: 978-2-9557474-0-7 Contents Preface v Message from the Programme Chair . vii Message from the Organizing Chair . viii Organization ix Programme Chair . xi Local Chair . xi Programme Committee . xi Organizing Committee . xi Sponsors . xii Invited Contributions xiii Program Proving with Coq – Pierre Castéran .........................1 Julia: to Lisp or Not to Lisp? – Stefan Karpinski .......................1 Lexical Closures and Complexity – Francis Sergeraert ...................2 Session I: Language design3 Refactoring Dynamic Languages Rafael Reia and António Menezes Leitão ..........................5 Type-Checking of Heterogeneous Sequences in Common Lisp Jim E. Newton, Akim Demaille and Didier Verna ..................... 13 A CLOS Protocol for Editor Buffers Robert Strandh ....................................... 21 Session II: Domain Specific Languages 29 Using Lisp Macro-Facilities for Transferable Statistical Tests Kay Hamacher ....................................... 31 A High-Performance Image Processing DSL for Heterogeneous Architectures Kai Selgrad, Alexander Lier, Jan Dörntlein, Oliver Reiche and Marc Stamminger .... 39 Session III: Implementation 47 A modern implementation of the LOOP macro Robert Strandh ....................................... 49 Source-to-Source Compilation via Submodules Tero Hasu and Matthew Flatt ............................... 57 Extending Software Transactional
    [Show full text]
  • A Web-Based, Pac-Man-Complete Hybrid Text and Visual Programming Language
    Politechnika Łódzka Wydział Fizyki Technicznej, Informatyki i Matematyki Stosowanej Instytut Informatyki Dariusz Jędrzejczak, 201208 Dual: a web-based, Pac-Man-complete hybrid text and visual programming language Praca magisterska napisana pod kierunkiem dr inż. Jana Stolarka Łódź 2016 ii Contents Contents iii 0 Introduction 1 0.1 Scope . .1 0.2 Choice of subject . .1 0.3 Related work . .2 0.4 Goals . .3 0.5 Structure . .3 1 Background 5 1.1 Web technologies . .5 1.1.1 Document Object Model . .5 1.1.2 JavaScript . .6 1.2 Design and implementation of Lisp . .8 1.2.1 Abstract syntax tree and program representation . 10 1.2.2 Text-based code editors . 10 1.2.3 Visual programming languages . 11 1.2.4 A note on history of VPLs . 13 1.2.5 Common criticisms of VPLs . 14 1.2.6 The problem with structure . 14 1.3 Screenshots . 16 2 Dual programming language 21 2.1 Introduction . 21 2.2 Syntax and grammar . 21 2.2.1 Basic syntax . 22 2.3 Comments . 23 2.4 Numbers . 24 2.5 Escape character . 25 2.6 Strings . 25 2.7 Basic primitives and built-ins . 25 2.7.1 Functions . 26 2.7.2 Language primitives . 27 2.7.3 Values . 30 2.8 Enhanced Syntax Tree . 31 iii CONTENTS CONTENTS 2.8.1 Structural representation of strings . 32 2.9 Syntax sugar for function invocations . 33 2.10 Pattern matching . 34 2.10.1 Destructuring . 36 2.10.2 match primitive . 36 2.11 Rest parameters and spread operator .
    [Show full text]
  • The Road to Perspective Are Often Badly Covered, If at All
    Coding with Lisp Coding with Lisp Developing Lisp code on a free software platform is no mean feat, and documentation, though available, is dispersed and comparison to solid, hefty common tools such as gcc, often too concise for users new to Lisp. In the second part of gdb and associated autobuild suite. There’s a lot to get used to here, and the implementation should be an accessible guide to this fl exible language, self-confessed well bonded with an IDE such as GNU Emacs. SLIME is a contemporary solution which really does this job, Lisp newbie Martin Howse assesses practical issues and and we’ll check out some integration issues, and outline further sources of Emacs enlightenment. It’s all implementations under GNU/Linux about identifying best of breed components, outlining solutions to common problems and setting the new user on the right course, so as to promote further growth. And as users do develop, further questions inevitably crop up, questions which online documentation is poorly equipped to handle. Packages and packaging from both a user and developer The Road To perspective are often badly covered, if at all. And whereas, in the world of C, everyday libraries are easy to identify, under Common Lisp this is far from the case. Efforts such as key SBCL (Steel Bank Common Lisp) developer and all round good Lisp guy, Dan Barlow’s cirCLe project, which aimed to neatly package implementation, IDE, documentation, libraries and packagingpackaging ttools,ools, wouldwould ccertainlyertainly mmakeake llifeife eeasierasier forfor tthehe nnewbie,ewbie, bbutut Graphical Common OpenMCL all play well here, with work in Lisp IDEs are a rare unfortunatelyunfortunately progressprogress doesdoes sseemeem ttoo hhaveave slowedslowed onon thisthis ffront.ront.
    [Show full text]
  • Factor: a Dynamic Stack-Based Programming Language
    Factor: a dynamic stack-based programming language Slava Pestov Daniel Ehrenberg Joe Groff Stack Effects LLC Carleton College Durian Software [email protected] [email protected] [email protected] ABSTRACT manipulation and making calls to system libraries written Factor is a new dynamic stack-based programming language. in C and in other languages, allowing for clean integration The language and implementation have evolved over several of high-level and low-level code within a single programming years, resulting in a purely object-oriented language with language. an optimizing native-code compiler and interactive devel- Factor has an advanced, high-performance implementa- opment environment. Factor's metaprogramming features tion. We believe good support for interactive development is have allowed it to implement in its standard library fea- invaluable, and for this reason Factor allows programmers to tures other languages have built-in, such as XML literal syn- test and reload code as it runs. Our ahead-of-time optimiz- tax and local variables. Factor combines ideas from Forth, ing compiler can remove much of the overhead of high-level Lisp, Smalltalk and C++ to form a general-purpose multi- language features. Objects are represented efficiently and paradigm programming language. generational garbage collection provides fast allocation and efficient reclamation. Together, these features make Factor a useful language for writing both quick scripts and large 1. INTRODUCTION programs in a high-level way. Factor is a dynamic stack-based programming language. Factor is an open-source project. It is available for free It was originally conceived as an experiment to create a download from http://factorcode.org.
    [Show full text]
  • Using Lisp Implementation Internals Unportable but Fun
    Journal of Universal Computer Science, vol. 16, no. 2 (2010), 315-339 submitted: 19/10/09, accepted: 10/12/09, appeared: 28/1/10 © J.UCS Using Lisp Implementation Internals Unportable but Fun Christophe Rhodes (Department of Computing Goldsmiths, University of London New Cross, London, SE14 6NW, United Kingdom [email protected]) Abstract: We present a number of developer tools and language extensions that are available for use with Steel Bank Common Lisp, but which are perhaps not as well- known as they could be. Our motivation is twofold: firstly, to introduce to a developer audience facilities that can make their development or deployment of software more rapid or efficient. Secondly, in the context of the development of the Common Lisp language itself, we offer some observations of patterns of use of such extensions within the development community, and discuss the implications this has on future evolution of the language. Key Words: Development tools – Language extensions – Language evolution – Lisp Category: D.2.3, D.2.12, D.3.3 1 Introduction Common Lisp the Language [Ste84] was published a quarter of a century ago; work done to improve and extend the language, in the context of the ANSI standardization process, finished fifteen years ago with the publication of ANSI document 226–1994 [PC94]. Since that time, the Common Lisp language as standardized through any formal process has not changed. In that quarter of a century, the culture of programmers new to a given lan- guage appears to have changed somewhat: a number of single-implementation languages, where the current state of the implementation acts as the sole defini- tion of the language’s semantics (with the exception of discrepancies between the implementation and its documentation), have appeared and gained cur- rency.
    [Show full text]
  • Monad Macros in Common Lisp
    Monad Macros in Common Lisp David Sorokin [email protected], Jan 2010 Contents Introduction .................................................................................................................................................. 2 General Case ................................................................................................................................................. 2 Bind Macros .................................................................................................................................................. 6 The Identity Monad ....................................................................................................................................... 7 The List Monad .............................................................................................................................................. 8 The Maybe Monad ...................................................................................................................................... 10 The Reader Monad ...................................................................................................................................... 12 The State Monad ......................................................................................................................................... 15 The Writer Monad ....................................................................................................................................... 19 Monad Transformers .................................................................................................................................
    [Show full text]