From de369b349747300828bf63430a6d354a7aae11cc Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Mon, 12 Nov 2007 00:52:43 -0500 Subject: [PATCH] * Copying an already immutable hashtable, and requesting an immutable table returns the same table without copying. --- scheme/ikarus.hash-tables.ss | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scheme/ikarus.hash-tables.ss b/scheme/ikarus.hash-tables.ss index 2798409..8bc7493 100644 --- a/scheme/ikarus.hash-tables.ss +++ b/scheme/ikarus.hash-tables.ss @@ -393,11 +393,15 @@ (case-lambda [(h) (if (hasht? h) - (hasht-copy h #f) + (if (hasht-mutable? h) + (hasht-copy h #f) + h) (error 'hashtable-copy "not a hash table" h))] [(h mutable?) (if (hasht? h) - (hasht-copy h (and mutable? #t)) + (if (or mutable? (hasht-mutable? h)) + (hasht-copy h (and mutable? #t)) + h) (error 'hashtable-copy "not a hash table" h))])) )