Mapping over a map

3 views
Skip to first unread message

James Thompson

unread,
Jul 17, 2024, 10:13:16 AM (10 days ago) Jul 17
to CEL Go Discussion Forum
Hi,

I've searched long and hard through the spec and the library and I'm struggling to figure out how to map over the keys and values of a map to yield another map.

I want to be able to do `{'foo': 1, 'bar': 2}.map(k,v, {k: v + 1})` to yield `{'foo': 2, 'bar': 3}`.

Is this at all possible using any existing macro functionality? I have managed to map over a map to yield a list of maps, but then I'm unable to figure out if you can flatten those maps. 

Any advice would be greatly appreciated!


Tristan Swadell

unread,
Jul 17, 2024, 11:58:53 AM (10 days ago) Jul 17
to James Thompson, CEL Go Discussion Forum
Hi James,

By the end of this quarter, the plan is to have a v2 of comprehensions to support map -> map transformations. 

-Tristan

--
You received this message because you are subscribed to the Google Groups "CEL Go Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cel-go-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cel-go-discuss/0db38080-4084-4e5f-a70d-21eb174b4f95n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages