mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-04 00:11:37 -08:00
New make-load-form method for hash tables
This commit is contained in:
parent
0758486bf5
commit
0f2021c924
1 changed files with 10 additions and 2 deletions
|
|
@ -51,14 +51,14 @@
|
|||
(unless (need-to-make-load-form-p object)
|
||||
(return-from make-load-form (if (consp object) `',object object)))
|
||||
(typecase object
|
||||
((array)
|
||||
(array
|
||||
`(make-array ,(array-dimensions object)
|
||||
:element-type ,(array-element-type object)
|
||||
:adjustable ,(array-adjustable-p object)
|
||||
:initial-data
|
||||
,(loop for i from 0 by (array-total-size object)
|
||||
collect (make-load-form (row-major-aref object i)))))
|
||||
((cons)
|
||||
(cons
|
||||
(do* ((x object)
|
||||
(out '()))
|
||||
((atom x)
|
||||
|
|
@ -68,6 +68,14 @@
|
|||
`(list* ,out ,(make-load-form x))
|
||||
`(list ,out))))
|
||||
(push x out)))
|
||||
(hash-table
|
||||
(values
|
||||
`(make-hash-table :size ,(hash-table-size object)
|
||||
:rehash-size ,(hash-table-rehash-size object)
|
||||
:rehash-threshold ,(hash-table-rehash-threshold object)
|
||||
:test ',(hash-table-test object))
|
||||
`(dolist (i ,(maphash (lambda (key obj) (cons key obj)) object))
|
||||
(setf (gethash (car i) ,object) (cdr i)))))
|
||||
(t
|
||||
(error "Cannot externalize object ~a" object))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue