Navigation
Synopsis A subscript is applied to a value that does not support it.
Description Subscription is available for values of various types including: Rascal:String, Rascal:Values/Node, Rascal:List/Subscription, Rascal:Map/Subscription, Rascal:Tuple/Subscription and Rascal:Relation/Subscription. This error is generated when subscription is applied to a value for which it is not defined.

Remedies:
  • Use another operation than subscription to extract the values you want.
  • Use another type (that does support subscription) to represent your data.
Examples Here are some correct uses of subscription:
rascal>"abc"[1];
str: "b"
rascal>[1,2,3][1];
int: 2
rascal>"f"(1,2,3)[1];
value: 2
rascal>("a":1, "b":2, "c":3)["b"]
int: 2
Here are some erroneous examples:
rascal>true[1];
|stdin:///|(5,1,<1,5>,<1,6>): subscript not supported on bool at |stdin:///|(5,1,<1,5>,<1,6>)
rascal>123[1];
|stdin:///|(4,1,<1,4>,<1,5>): subscript not supported on int at |stdin:///|(4,1,<1,4>,<1,5>)
rascal>{1,2,3}[1];
|stdin:///|(8,1,<1,8>,<1,9>): subscript not supported on set[int] at |stdin:///|(8,1,<1,8>,<1,9>)
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.