💾 Archived View for republic.circumlunar.space › users › dbane › lsp_doc › bane.20.cdr15.gmi captured on 2024-05-26 at 15:25:50. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-10-31)

-=-=-=-=-=-=-

title: An ISLisp-like subset of ANSI Common Lisp

author: Darren Bane

copyright: 2020 Darren Bane, CC BY-SA

Abstract

A subset of Common Lisp that has rough feature parity with ISLisp is defined.

Introduction

There are many Common Lisp coding standards encoding the opinion of various experts. This document defines yet another, but relies on the opinions of the ISLisp standard committee instead.

The ANSI Common Lisp standard explicitly allows subsets. ISLisp was designed to be "culturally-compatible" with Common Lisp, and indeed it is only moderate work to port between them (and incidentally, also ELisp).

Procedure

Write an ISLisp program, making the following adaptations:

┌───────────────────┬───────────────────────────────┐
│      ISLisp       │              CL               │
╞═══════════════════╪═══════════════════════════════╡
│ (:abstractp t)    │ (:metaclass <abstract-class>) │
├───────────────────┼───────────────────────────────┤
│ (class x)         │ (find-class 'x)               │
├───────────────────┼───────────────────────────────┤
│ create            │ make-instance                 │
├───────────────────┼───────────────────────────────┤
│ defglobal         │ defvar                        │
├───────────────────┼───────────────────────────────┤
│ for               │ do                            │
├───────────────────┼───────────────────────────────┤
│ quotient          │ /                             │
├───────────────────┼───────────────────────────────┤
│ (standard-output) │ *standard-output*             │
├───────────────────┼───────────────────────────────┤
│ (while t b)       │ (loop while t do b)           │
└───────────────────┴───────────────────────────────┘

ISLisp doesn't have the following features (and probably many more):

CL doesn't have the `*-dynamic` functions, it's probably best to avoid dynamic scoping anyway.

Extensions to ISLisp

It was noted in the ISLisp standard document that the committee would have liked to define packages. So I recommend the following pattern, using the subset of CL packages that OpenLisp supports:

(require "dependency")
(defpackage #:pack
  (:use #:common-lisp #:dependency)
  (:export
    #:fun))
(in-package #:pack)
...
(provide "pack")