[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlaplus] How do you write a literal function?



Hi Thomas,

You can use a structure:

Op == [foo |-> "bar", baz |-> "blah"]

H

On 8/11/2020 12:50 PM, Thomas Gebert wrote:
Howdy. 

If I want to write a literal definition of a function that has a sequential set of integers as its domain, I can of course use the tuple syntax `<<"a", "b", "c">>`, but how might I go about doing this with anything but an integer index, e.g. a string? For example, what if I wanted to have something more or less akin to this in _javascript_: 

var myObj = {
  "foo":"bar",
  "baz": "blah"
}

myObj["foo"] // "bar". 


--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/f57ef2a7-212b-465e-a3de-fac154d233cco%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/aad60439-a85a-fcf3-2eb6-b2686595f851%40gmail.com.