From 2c5b7fc27ab80d3539264a375849ae27b7f84e79 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Wed, 24 Jun 2026 09:13:28 -0400 Subject: [PATCH] Support metadata on lazy seqs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with-meta/meta only recognized the eager collections, so (with-meta (map-indexed …) m) — a lazy seq — threw "value does not support metadata". A lazy seq is IObj on the JVM; add it to the metadatable set (keyed in the side-table by identity, like cseq/procedure). --- host/chez/natives-meta.ss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/chez/natives-meta.ss b/host/chez/natives-meta.ss index 2c98ac3..36ab7fa 100644 --- a/host/chez/natives-meta.ss +++ b/host/chez/natives-meta.ss @@ -19,7 +19,7 @@ (jolt-assoc (if user user (jolt-hash-map)) jolt-kw-var-ns (var-cell-ns x) jolt-kw-var-name (var-cell-name x)))) - ((or (pvec? x) (pmap? x) (pset? x) (cseq? x) (empty-list-t? x) (jrec? x) (procedure? x)) + ((or (pvec? x) (pmap? x) (pset? x) (cseq? x) (empty-list-t? x) (jolt-lazyseq? x) (jrec? x) (procedure? x)) (hashtable-ref meta-table x jolt-nil)) (else jolt-nil))) @@ -36,7 +36,7 @@ (define (jolt-with-meta x m) (cond ((symbol-t? x) (make-symbol-t (symbol-t-ns x) (symbol-t-name x) m)) - ((or (pvec? x) (pmap? x) (pset? x) (cseq? x) (empty-list-t? x) (jrec? x) (procedure? x)) + ((or (pvec? x) (pmap? x) (pset? x) (cseq? x) (empty-list-t? x) (jolt-lazyseq? x) (jrec? x) (procedure? x)) (let ((c (meta-copy x))) (if (jolt-nil? m) (hashtable-delete! meta-table c) (hashtable-set! meta-table c m)) c))