CMUCL User's Manual

Total Page:16

File Type:pdf, Size:1020Kb

CMUCL User's Manual CMUCL User’s Manual Robert A. MacLachlan, Editor Mar 2009 Release 19f CMUCL is a free, high-performance implementation of the Common Lisp programming lan- guage, which runs on most major Unix platforms. It mainly conforms to the ANSI Common Lisp Standard. CMUCL features a sophisticated native-code compiler, a foreign function interface, a graphical source-level debugger, an interface to the X11 Window System, and an Emacs-like edi- tor. Keywords: lisp, Common Lisp, manual, compiler, programming language implementation, pro- gramming environment This manual is based on CMU Technical Report CMU-CS-92-161, edited by Robert A. MacLachlan, dated July 1992. Contents 1 Introduction 1 1.1 Distribution and Support . 1 1.2 Command Line Options . 2 1.3 Credits . 3 2 Design Choices and Extensions 6 2.1 Data Types . 6 2.1.1 Integers . 6 2.1.2 Floats . 6 2.1.3 Extended Floats . 9 2.1.4 Characters . 10 2.1.5 Array Initialization . 10 2.1.6 Hash tables . 10 2.2 Default Interrupts for Lisp . 11 2.3 Implementation-Specific Packages . 12 2.4 Hierarchical Packages . 13 2.4.1 Introduction . 13 2.4.2 Relative Package Names . 13 2.4.3 Compatibility with ANSI Common Lisp . 14 2.5 Package Locks . 15 2.5.1 Rationale . 15 2.5.2 Disabling package locks . 16 2.6 The Editor . 16 2.7 Garbage Collection . 16 2.7.1 GC Parameters . 17 2.7.2 Generational GC . 18 2.7.3 Weak Pointers . 19 2.7.4 Finalization . 19 2.8 Describe . 19 2.9 The Inspector . 20 2.9.1 The Graphical Interface . 20 2.9.2 The TTY Inspector . 20 2.10 Load . 21 2.11 The Reader . 21 2.11.1 Reader Extensions . 21 2.11.2 Reader Parameters . 22 2.12 Stream Extensions . 22 2.13 Simple Streams . 22 2.14 Running Programs from Lisp . 22 2.14.1 Process Accessors . 24 2.15 Saving a Core Image . 25 2.16 Pathnames . 26 2.16.1 Unix Pathnames . 26 2.16.2 Wildcard Pathnames . 27 i CONTENTS ii 2.16.3 Logical Pathnames . 27 2.16.4 Search Lists . 27 2.16.5 Predefined Search-Lists . 27 2.16.6 Search-List Operations . 28 2.16.7 Search List Example . 28 2.17 Filesystem Operations . 28 2.17.1 Wildcard Matching . 29 2.17.2 File Name Completion . 29 2.17.3 Miscellaneous Filesystem Operations . 29 2.18 Time Parsing and Formatting . 30 2.19 Random Number Generation . 31 2.19.1 MT-19937 Generator . 31 2.20 Lisp Threads . 31 2.21 Lisp Library . 32 2.22 Generalized Function Names . 32 2.23 CLOS . 32 2.23.1 Primary Method Errors . 32 2.23.2 Slot Type Checking . 33 2.23.3 Slot Access Optimization . 33 2.23.4 Inlining Methods in Effective Methods . 35 2.23.5 Effective Method Precomputation . 36 2.23.6 Sealing . 36 2.23.7 Method Tracing and Profiling . 36 2.23.8 Misc . 37 2.24 Differences from ANSI Common Lisp . 37 2.24.1 Extensions . 37 2.25 Function Wrappers . 37 2.26 Dynamic-Extent Declarations . 39 2.26.1 &rest argument lists . 40 2.26.2 Closures . 40 2.26.3 list, list*, and cons .......................................... 40 2.27 Modular Arithmetic . 40 2.28 Extension to REQUIRE . 41 3 The Debugger 42 3.1 Debugger Introduction . 42 3.2 The Command Loop.
Recommended publications
  • The Copyright Law of the United States (Title 17, U.S
    NOTICE WARNING CONCERNING COPYRIGHT RESTRICTIONS: The copyright law of the United States (title 17, U.S. Code) governs the making of photocopies or other reproductions of copyrighted material. Any copying of this document without permission of its author may be prohibited by law. CMU Common Lisp User's Manual Mach/IBM RT PC Edition David B. McDonald, Editor April 1989 CMU-CS-89-132 . School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 This is a revised version of Technical Report CMU-CS-87-156. Companion to Common Lisp: The Language Abstract CMU Common Lisp is an implementation of Common Lisp that currently runs on the IBM RT PC under Mach, a Berkeley Unix 4.3 binary compatible operating system. This document describes the implementation dependent choices made in developing this implementation of Common Lisp. Also, several extensions have been added, including the proposed error system, a stack crawling debugger, a stepper, an interface to Mach system calls, a foreign function call interface, the ability to write assembler language routines, and other features that provide a good environment for developing Lisp code. This research was sponsored by the Defense Advanced Research Projects Agency (DOD), ARPA Order No. 4976 under contract F33615-87-C-1499 and monitored by the Avionics Laboratory, Air Force Wright Aeronautical Laboratories, Aeronautical Systems Division (AFSC), Wright-Patterson AFB, OHIO 45433-6543. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the Defense Advanced Research Projects Agency or the U.S.
    [Show full text]
  • Allegro CL User Guide
    Allegro CL User Guide Volume 1 (of 2) version 4.3 March, 1996 Copyright and other notices: This is revision 6 of this manual. This manual has Franz Inc. document number D-U-00-000-01-60320-1-6. Copyright 1985-1996 by Franz Inc. All rights reserved. No part of this pub- lication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means electronic, mechanical, by photocopying or recording, or otherwise, without the prior and explicit written permission of Franz incorpo- rated. Restricted rights legend: Use, duplication, and disclosure by the United States Government are subject to Restricted Rights for Commercial Software devel- oped at private expense as specified in DOD FAR 52.227-7013 (c) (1) (ii). Allegro CL and Allegro Composer are registered trademarks of Franz Inc. Allegro Common Windows, Allegro Presto, Allegro Runtime, and Allegro Matrix are trademarks of Franz inc. Unix is a trademark of AT&T. The Allegro CL software as provided may contain material copyright Xerox Corp. and the Open Systems Foundation. All such material is used and distrib- uted with permission. Other, uncopyrighted material originally developed at MIT and at CMU is also included. Appendix B is a reproduction of chapters 5 and 6 of The Art of the Metaobject Protocol by G. Kiczales, J. des Rivieres, and D. Bobrow. All this material is used with permission and we thank the authors and their publishers for letting us reproduce their material. Contents Volume 1 Preface 1 Introduction 1.1 The language 1-1 1.2 History 1-1 1.3 Format
    [Show full text]
  • Flexichain: an Editable Sequence and Its Gap-Buffer Implementation
    Flexichain: An editable sequence and its gap-buffer implementation Robert Strandh (LaBRI∗), Matthieu Villeneuve, Tim Moore (LaBRI) 2004-04-05 Abstract Flexichain is an API for editable sequences. Its primary use is in end-user applications that edit sequences of objects such as text editors (characters), word processors (characters, paragraphs, sections, etc), score editors (notes, clusters, measures, etc), though it can also be used as a stack and a double- ended queue. We also describe an efficient implementation of the API in the form of a cir- cular gap buffer. Circularity avoids a common worst case in most implemen- tations, makes queue operations efficient, and makes worst-case performance twice as good as that of ordinary implementations 1 Introduction Editable sequences are useful, in particular in interactive applications such as text editors, word processors, score editors, and more. In such applications, it is highly likely that an editing operation is close to the previous one, measured as the dif- ference in positions in the sequence. This statistical behavior makes it feasible to implement the editable sequence as a gap buffer. The basic idea is to store objects in a vector that is usually longer than the number of elements stored in it. For a sequence of N elements where editing is required at ∗Laboratoire Bordelais de Recherche en Informatique, Bordeaux, France 1 index i, elements 0 through i are stored at the beginning of the vector, and elements i + 1 through N − 1 are stored at the end of the vector. When the vector is longer N, this storage leaves a gap.
    [Show full text]
  • The Embeddable Common Lisp
    ACM Lisp Pointers 8(1), 1995, 30-41 The Embeddable Common Lisp Giuseppe Attardi Dipartimento di Informatica, Universit`adi Pisa Corso Italia 40, I-56125 Pisa, Italy net: [email protected] Abstract The Embeddable Common Lisp is an implementation of Common Lisp designed for being embeddable within C based applications. ECL uses standard C calling conventions for Lisp compiled functions, which allows C programs to easily call Lisp functions and viceversa. No foreign function interface is required: data can be exchanged between C and Lisp with no need for conversion. ECL is based on a Common Runtime Support (CRS) which provides basic facilities for memory management, dynamic loading and dumping of binary images, support for multiple threads of execution. The CRS is built into a library that can be linked with the code of the application. ECL is modular: main modules are the program development tools (top level, debugger, trace, stepper), the compiler, and CLOS. A native implementation of CLOS is available in ECL: one can configure ECL with or without CLOS. A runtime version of ECL can be built with just the modules which are required by the application. 1 Introduction As applications become more elaborate, the facilities required to build them grow in number and sophistica- tion. Each facility is accessed through a specific package, quite complex itself, like in the cases of: modeling, simulation, graphics, hypertext facilities, data base management, numerical analysis, deductive capabilities, concurrent programming, heuristic search, symbolic manipulation, language analysis, special device control. Reusability is quite a significant issue: once a package has been developed, tested and debugged, it is un- desirable having to rewrite it in a different language just because the application is based in such other language.
    [Show full text]
  • ASDF 3, Or Why Lisp Is Now an Acceptable Scripting Language (Extended Version)
    ASDF 3, or Why Lisp is Now an Acceptable Scripting Language (Extended version) François-René Rideau Google [email protected] Abstract libraries, or network services; one can scale them into large, main- ASDF, the de facto standard build system for Common Lisp, has tainable and modular systems; and one can make those new ser- been vastly improved between 2009 and 2014. These and other im- vices available to other programs via the command-line as well as provements finally bring Common Lisp up to par with "scripting via network protocols, etc. languages" in terms of ease of writing and deploying portable code The last barrier to making that possible was the lack of a that can access and "glue" together functionality from the underly- portable way to build and deploy code so a same script can run ing system or external programs. "Scripts" can thus be written in unmodified for many users on one or many machines using one or Common Lisp, and take advantage of its expressive power, well- many different compilers. This was solved by ASDF 3. defined semantics, and efficient implementations. We describe the ASDF has been the de facto standard build system for portable most salient improvements in ASDF and how they enable previ- CL software since shortly after its release by Dan Barlow in 2002 ously difficult and portably impossible uses of the programming (Barlow 2004). The purpose of a build system is to enable divi- language. We discuss past and future challenges in improving this sion of labor in software development: source code is organized key piece of software infrastructure, and what approaches did or in separately-developed components that depend on other compo- didn’t work in bringing change to the Common Lisp community.
    [Show full text]
  • GNU/Linux AI & Alife HOWTO
    GNU/Linux AI & Alife HOWTO GNU/Linux AI & Alife HOWTO Table of Contents GNU/Linux AI & Alife HOWTO......................................................................................................................1 by John Eikenberry..................................................................................................................................1 1. Introduction..........................................................................................................................................1 2. Traditional Artificial Intelligence........................................................................................................1 3. Connectionism.....................................................................................................................................1 4. Evolutionary Computing......................................................................................................................1 5. Alife & Complex Systems...................................................................................................................1 6. Agents & Robotics...............................................................................................................................1 7. Programming languages.......................................................................................................................2 8. Missing & Dead...................................................................................................................................2 1. Introduction.........................................................................................................................................2
    [Show full text]
  • WCL: Delivering Efficient Common Lisp Applications Under Unix 1
    WCL: Delivering Efficient Common Lisp Applications under Unix Wade Hennessey Center for Design Research Stanford University wade@ sunrise. stanf ord. edu Abstract: Common Lisp implementations for Unix from foreign data. However, because Lisp programs can- have traditionally provided a rich development environ- not be provided to other programmers in a form com- ment at the expense of an inefficient delivery environ- patible with the native system linker, Lisp must remain ment. The goal of WCL is to allow hundreds of Lisp “in control” by linking foreign code into the Lisp image. applications to be realistically available at once, while Unfortunately, foreign debugging information is usually allowing several of them to run concurrently. WCL ac- lost in the process, thus making debugging of mixed complishes this by providing Common Lisp as a Unix language programa difficult. shared library that can be linked with Lisp and C code Standalone applications are produced by dynami- to produce efficient applications. For example, the cally loading application code into a running Lisp and executable for a Lisp version of the canonical “Hello then saving a memory image to disk. Autoloading can World!” program requires only 40k bytes under SunOS be used to delay the loading of code until runtime, thus 4.1 for SPARC. WCL also supports a full development reducing image size, but it can substantially increase the environment, including dynamic file loading and debug- startup time of an application. Treeshakers and selec- ging. A modified version of GDB [1], the GNU Debug- tive loading of subparts of the Lisp system are also used ger, is used to debug WCL programs, providing support to reduce the size of saved memory images, but the in- for mixed language debugging.
    [Show full text]
  • Programming Environments John Foderaro In
    Programming Environments John Foderaro In this issue we feature a description of Delph! Common Lisp, an enhanced version of Kyoto Common Lisp. Company: Delphi S.p.A. Via della Vetraia, 11 1-55049 Viareggio, Italy tel: + 39 (584) 395225 fax: + 39 (584) 395366 tlx: 501542 DELPlll I Product name: Delphi Common Lisp Version of product described: All versions. This version available when: This year. Contact Delphi for more information. Hardware available on: Sun 3, Sun 4, Sun 386i, general 386-based machines running Unix system V. Available on a wide variety of hardware and operating systems in the near future. Delphi Common Lisp is a full implementation of Common Lisp than runs on a range of general-purpose computers. DCL provides several major facilities on top of the Common Lisp standard to provide a more complete and powerful programming language including - Common Lisp Object System, in complete accordance with the ANSI X3J 13 subcommittee proposal. - CLX, the emerging standard binding between Common l,isp and the X Window system "client" functionality. It's implemented entirely in Lisp (doesn't go through XLib) and provides direct access from Lisp to all X Window client functions. - "Multithread" facility to create and control concurrent threads of program execution. Useful for U.I. design and other applications where interrupts can come from a variety of sources as well as parallel processing research. - ttigh productivity facilities like ZetaLisp LOOP macro, Symbolics-style DEFSYSTEM, autoioad facility, EMACS editor interface Influence: The Common Lisp component of DCL is based on Kyoto Common Lisp, meaning that it's extremely portable and, now, performs quite well.
    [Show full text]
  • CLX — Common LISP X Interface
    CLX Common LISP X Interface 1988, 1989 Texas Instruments Incorporated Permission is granted to any individual or institution to use, copy, modify and distribute this document, provided that this complete copyright and permission notice is maintained, intact, in all copies and supporting documentation. Texas Instruments Incorporated makes no representations about the suitability of this document or the software described herein for any purpose. It is provided ”as is” without express or implied warranty. CLX Programmer’s Reference i ACKNOWLEDGMENTS Primary Interface Author: Robert W. Scheifler MIT Laboratory for Computer Science 545 Technology Square, Room 418 Cambridge, MA 02139 [email protected] Primary Implementation Author: LaMott Oren Texas Instruments PO Box 655474, MS 238 Dallas, TX 75265 [email protected] Design Contributors: Dan Cerys, BBN Scott Fahlman, CMU Kerry Kimbrough, Texas Instruments Chris Lindblad, MIT Rob MacLachlan, CMU Mike McMahon, Symbolics David Moon, Symbolics LaMott Oren, Texas Instruments Daniel Weinreb, Symbolics John Wroclawski, MIT Richard Zippel, Symbolics Documentation Contributors: Keith Cessna, Texas Instruments Kerry Kimbrough, Texas Instruments Mike Myjak LaMott Oren, Texas Instruments Dan Stenger, Texas Instruments The X Window System is a trademark of MIT. UNIX is a trademark of AT&T Bell Laboratories. ULTRIX, ULTRIX–32, ULTRIX–32m, ULTRIX–32w, and VAX/VMS are trademarks of Digital Equipment Corporation. ii CLX Programmer’s Reference CONTENTS Section Title 1 INTRODUCTION TO CLX 2 DISPLAYS 3 SCREENS 4 WINDOWS AND PIXMAPS 5 GRAPHICS CONTEXTS 6 GRAPHIC OPERATIONS 7 IMAGES 8 FONTS AND CHARACTERS 9 COLORS 10 CURSORS 11 ATOMS, PROPERTIES, AND SELECTIONS 12 EVENTS AND INPUT 13 RESOURCES 14 CONTROL FUNCTIONS 15 EXTENSIONS 16 ERRORS A PROTOCOL VS.
    [Show full text]
  • CAPI User Guide Version 6.1 Copyright and Trademarks CAPI User Guide (Macintosh Version) Version 6.1 August 2011 Copyright © 2011 by Lispworks Ltd
    LispWorks® for Macintosh CAPI User Guide Version 6.1 Copyright and Trademarks CAPI User Guide (Macintosh version) Version 6.1 August 2011 Copyright © 2011 by LispWorks Ltd. All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of LispWorks Ltd. The information in this publication is provided for information only, is subject to change without notice, and should not be construed as a commitment by LispWorks Ltd. LispWorks Ltd assumes no responsibility or liability for any errors or inaccuracies that may appear in this publication. The software described in this book is furnished under license and may only be used or copied in accordance with the terms of that license. LispWorks and KnowledgeWorks are registered trademarks of LispWorks Ltd. Adobe and PostScript are registered trademarks of Adobe Systems Incorporated. Other brand or product names are the registered trade- marks or trademarks of their respective holders. The code for walker.lisp and compute-combination-points is excerpted with permission from PCL, Copyright © 1985, 1986, 1987, 1988 Xerox Corporation. The XP Pretty Printer bears the following copyright notice, which applies to the parts of LispWorks derived therefrom: Copyright © 1989 by the Massachusetts Institute of Technology, Cambridge, Massachusetts. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that this copyright and permission notice appear in all copies and supporting documentation, and that the name of M.I.T.
    [Show full text]
  • CS 131 (Eggert) Notes W 1 M Lec 1-10-17 Microsoft Interview Was This
    CS 131 (Eggert) Notes W 1 M Lec 1-10-17 • Microsoft interview was this exact same question! • This is one of the most famous problems in Computer Science • NOT the halting problem or P = NP, but rather a programming language problem • Solved by Donald Knuth, a Turing Award winner • Knuth was a Professor at Stanford, formerly at CalTech. • At CalTech, he decided to write a textbook to write about everything important about computer programming • 1962 and the field was still young! • CS 31 and 32 of the day and the last chapter would be about programming languages • Knuth is a world-class computer science researcher and he is OCD about writing the best possible book • NOT embarrassed to jump into calculus to explain why it runs efficiently. • Published by Addison-Wesley in 1969 (first class academic publisher) • The plates were all created by hand • Knuth wasn’t happy! • The book looked okay but he thought we should be doing something better. • Wrote a tool to help him generate the book. • When a job is NOT done well, you write a program to automate the repeated part. • TEX - source code that the TEX processor reads and generates something that looks nice on the screen. • Knuth found images for a book that were better than the Addison-Wesley ones did by hand Fundamental Algorithms is now done with TEX! • The TEX output is so good that now, CS professionals use TEX! • Word just isn’t good at this. • Knuth being a software engineer as well as an academic wanted to write this TEX program so that he could do his own book but other people could use the program as well.
    [Show full text]
  • Release Notes and Installation Guide
    LispWorks® Release Notes and Installation Guide Version 4 .4.5 Copyright and Trademarks LispWorks Release Notes and Installation Guide Version 4.4.5 March 2005 Copyright © 2005 by LispWorks Ltd. All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of LispWorks Ltd. The information in this publication is provided for information only, is subject to change without notice, and should not be construed as a commitment by LispWorks Ltd. LispWorks Ltd assumes no responsibility or liability for any errors or inaccuracies that may appear in this publication. The software described in this book is furnished under license and may only be used or copied in accordance with the terms of that license. LispWorks and KnowledgeWorks are registered trademarks of LispWorks Ltd. Adobe and PostScript are registered trademarks of Adobe Systems Incorporated. Other brand or product names are the registered trade- marks or trademarks of their respective holders. The code for walker.lisp and compute-combination-points is excerpted with permission from PCL, Copyright © 1985, 1986, 1987, 1988 Xerox Corporation. CLX and CLUE bear the following copyright notice, which applies to the parts of LispWorks derived therefrom: Texas Instruments Incorporated, P.O. Box 149149, MS 2151, Austin, Texas 78714-9149 Copyright © 1987, 1988, 1989, 1990, 1991 Texas Instruments Incorporated. Permission is granted to any individual or institution to use, modify and distribute this software, provided that this complete copyright and permission notice is maintained, intact, in all copies and documentation.
    [Show full text]