From 16149c4c7ad2325520f7bf58d6b20d00c0187abd Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Sun, 21 May 1989 17:14:29 +0000 Subject: [PATCH] Add a new global procedure, obarray->list so that symbols can be filtered, etc. --- v7/src/runtime/global.scm | 22 ++++++++++++++++++++-- v8/src/runtime/global.scm | 22 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/v7/src/runtime/global.scm b/v7/src/runtime/global.scm index 694331f8e..3852afcf9 100644 --- a/v7/src/runtime/global.scm +++ b/v7/src/runtime/global.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/global.scm,v 14.7 1988/08/15 21:58:20 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/global.scm,v 14.8 1989/05/21 17:14:29 jinx Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -258,4 +258,22 @@ MIT in each case. |# (object-new-type (ucode-type true) 1)) (define unspecific - (object-new-type (ucode-type true) 1)) \ No newline at end of file + (object-new-type (ucode-type true) 1)) + +;;;; Obarray->list + +(define (obarray->list #!optional obarray) + (let ((table (if (default-object? obarray) + (fixed-objects-item 'OBARRAY) + obarray))) + (let per-bucket ((index (-1+ (vector-length table))) (accumulator '())) + (if (< index 0) + accumulator + (let per-symbol + ((bucket (vector-ref table index)) + (accumulator accumulator)) + (if (null? bucket) + (per-bucket (-1+ index) accumulator) + (per-symbol + (cdr bucket) + (cons (car bucket) accumulator)))))))) \ No newline at end of file diff --git a/v8/src/runtime/global.scm b/v8/src/runtime/global.scm index 3cdc09a43..5a66f7b9a 100644 --- a/v8/src/runtime/global.scm +++ b/v8/src/runtime/global.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/global.scm,v 14.7 1988/08/15 21:58:20 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/global.scm,v 14.8 1989/05/21 17:14:29 jinx Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -258,4 +258,22 @@ MIT in each case. |# (object-new-type (ucode-type true) 1)) (define unspecific - (object-new-type (ucode-type true) 1)) \ No newline at end of file + (object-new-type (ucode-type true) 1)) + +;;;; Obarray->list + +(define (obarray->list #!optional obarray) + (let ((table (if (default-object? obarray) + (fixed-objects-item 'OBARRAY) + obarray))) + (let per-bucket ((index (-1+ (vector-length table))) (accumulator '())) + (if (< index 0) + accumulator + (let per-symbol + ((bucket (vector-ref table index)) + (accumulator accumulator)) + (if (null? bucket) + (per-bucket (-1+ index) accumulator) + (per-symbol + (cdr bucket) + (cons (car bucket) accumulator)))))))) \ No newline at end of file -- 2.25.1