Throughout the language specifications, examples are shown in MSL Text. MSL Text is a plain text file of MSL expressions, evaluated in order.
(msl hello-world This MSL Text returns Hello World!) (@hello Hello World!) ⇒ Hello World!
Many examples include a '(@CLEAR)' admin command which empties the Hybrid Database.
MSL expressions you evaluate with Nebula will run in the context of your current machine. The return values you see from the examples will represent the values in the Hybrid Database at the time you run them. This may cause the examples to have different results than the ones shown in the specifications. The
(@CLEAR) admin command is used in several examples to demonstrate the expected results from a "clear" or empty Hybrid Database.
The examples are designed to copy, paste, and run in Nebula. See Nebula Testbed for details.
Hover over the right corner of an MSL text example to copy it.
Paste the MSL text into the Nebula testbed to evaluate some or all of the expressions.
Nebula returns two values for each expression submitted to the Hybrid Database. The first value is the 2-form MSL representing the submitted expression. The second value, returned on a separate admin wire in Nebula, is the narrative value (often shortened to just value) of the expression, such as would be returned in narrative text like a sentence or paragraph.
The examples employ an arrow syntax to show the expected results from the admin wire and, optionally, the MSL wire when these are relevant to the example. This syntax is supported in the Nebula Testbed.
The arrow syntax is a feature of the Nebula Testbed and not part of the MSL specifications. Because of this syntax, Nebula does not support the arrow sequences inside MSL expressions.
Nebula supports any combination of three types of arrows. These are all normalized to the first type shown below and used throughout the specifications.
(@WALT Walt Disney) ⇒ Walt Disney (@WALT:birthday 1901) → 1901 (@WALT) --> (@WALT Walt Disney :birthday 1901) --> Walt Disney
When one arrow is present, it points to the expected admin result.
The following example shows the single arrow syntax for
(@WALT:birthday 1901) and how it appears in Nebula Testbed results.
(@WALT Walt Disney) (@WALT:birthday 1901) ⇒ 1901
The expected admin result of
1901 matched the value specified by the arrow syntax, and so the result is green. A second arrow was not present (representing MSL results), and so that result is blue.
When two arrows are present, the first points to the expected MSL result and the second to the expected admin result.
The following example shows the two arrow syntax for
(@DONALD) and how it appears in Nebula.
(@DONALD Donald Duck) (@DONALD :girlfriend (@DAISY Daisy Duck)) (@DONALD) ⇒ (@DONALD Donald Duck :girlfriend (@DAISY Daisy Duck)) ⇒ Donald Duck
In line 3, the two arrow syntax specifies both an MSL and an admin result, which were matched by Nebula and colored green. The blue results from lines 1 and 2 indicate that no arrow syntax appeared on those lines.
Using the additional controls in the Nebula Testbed, you can further edit the MSL text into a test suite for your own application. The Testbed offers a number of features for test-driven development with MSL. You can save your MSL programs as MSL text or JSON.