1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-06 02:23:03 +00:00

Merge pull request #1142 from tionis/thaw

added thaw to complement freeze
This commit is contained in:
Calvin Rose
2023-05-21 08:09:47 -05:00
committed by GitHub
2 changed files with 22 additions and 0 deletions

View File

@@ -2142,6 +2142,19 @@
:buffer (string x)
x))
(defn thaw
`Thaw an object (make it mutable) and do a deep copy, making
child value also mutable. Closures, fibers, and abstract
types will not be recursively thawed, but all other types will`
[ds]
(case (type ds)
:array (walk-ind thaw ds)
:tuple (walk-ind thaw ds)
:table (walk-dict thaw (table/proto-flatten ds))
:struct (walk-dict thaw (struct/proto-flatten ds))
:string (buffer ds)
ds))
(defn macex
``Expand macros completely.
`on-binding` is an optional callback for whenever a normal symbolic binding