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

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



That works...Thanks! For some reason, I thought that a set had to be on the left side of the |->...must have confused it for ->. 

On Tuesday, August 11, 2020 at 5:54:26 PM UTC-4, Hillel Wayne wrote:

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 tla...@googlegroups.com.
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/fe056338-3798-4770-bf53-7beeace490e8o%40googlegroups.com.