Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make an `object!` from a `map!`

Tags:

red-lang

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

like image 617
Dave Andersen Avatar asked Feb 28 '26 05:02

Dave Andersen


1 Answers

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
]
like image 165
Dave Andersen Avatar answered Mar 06 '26 21:03

Dave Andersen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!