Replies: 3 comments 8 replies
-
Ignoring implementation and data-space concerns (can the map grow once new words are subsequently added), it would be nice to avoid the
Would there be possible Maybe consider how the other operations on the |
Beta Was this translation helpful? Give feedback.
-
I use wordlists as maps. vocabulary my-map Then You can wrap it up in whatever syntactic sugar you want, or create the map entries programmatically, ... |
Beta Was this translation helpful? Give feedback.
-
Implementation details are left to the reader, but we (MPE/W&P) use a similar scheme for parsing C enums in Forth. github appears to use a very peculiar version of Markdown. |
Beta Was this translation helpful? Give feedback.
-
How would you express a list/map/set of key-value pairs (string, string) in Forth code, inside a definition?
In procedural style it could be expressed as:
Where
-add-map-entry ( mapid sd.value sd.name -- )
appends a pair into a map.But I'm interested in a literal form that just puts this mapid on the stack (as an example).
It doesn't matter how it can be implemented, only how it looks like in Forth code, and whether you like it.
As an example which I don't yet like much, this map can be expressed in a form of S-expression as:
Or even slightly simpler:
Beta Was this translation helpful? Give feedback.
All reactions