Question

I have a variable of type value that stores a map, but I can not access the values by providing the keys:

rascal>a
value: ("s":"s")

rascal>a["s"]
|stdin:///|(2,3,<1,2>,<1,5>): subscript not supported on value at |stdin:///|(2,3,<1,2>,<1,5>)
☞ Advice

How can I parse the value to map in order to be able to retrieve my value ?

Was it helpful?

Solution

if (map[str,str] myMap := a) {
   // do stuff with myMap
}
else {
  throw "<a> is not a map?";
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top