I have a map!
: #(a: 1)
and want to convert it to an equivalent object!
like: [a: 1]
.
Asked
Active
Viewed 58 times
3

Dave Andersen
- 5,337
- 3
- 30
- 29
-
Not every map! can be converted to an object: `object body-of m: #("1" "test")` will generate an empty object, while `object body-of m: #(a: test)` will fail with `Script Error: test has no value` – endo64 Sep 14 '21 at 07:02
1 Answers
2
Generate the object spec by converting the map to a block first. The map keys must all be word!
s.
>> object to-block #(a: 5)
== make object! [
a: 5
]

Dave Andersen
- 5,337
- 3
- 30
- 29
-
1May or may not be what you'd expect when you have stuff nested: `#(a: 5 b: #(c: 3))` – Geeky I May 18 '17 at 15:28
-