3

I have a map!: #(a: 1) and want to convert it to an equivalent object! like: [a: 1].

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 Answers1

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