On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Hello,

There's probably a trick for that, but I didn't find a way to create a single element dict:


("foo") dict ("bar") => {"f":"b", "o": "r"}



Whereas:

("foo", "baz") dict ("bar", "qux")


does the expected.


The straightforward way is to use the "list" operator, which wraps its argument in a length-1 list:

 (list "foo") dict (list "bar") 
{"foo":"bar"}

A fancier, more concise way (provided your keys are strings) is to perform an amending assignment to an empty list, like so:

 ().foo:"bar"
{"foo":"bar"}
(+1)

Thanks! very helpful!