16.3. Sling Programming
This section shows how to program in Sling. Playing with Sling is fun. You can start the Sling IDE with
> java sjm.examples.sling.SlingIde
16.3.1. A Basic Sling
Sling lets you plot mathematical functions by issuing plot commands. The namesake of Sling is the sling() function, which takes two arguments: the length of the sling strap, and the number of times the sling goes around (one's head). For example, to plot the path of a sling whose strap length is 1 and that travels three-quarters of a revolution, run the class SlingIde and enter the Sling program
plot sling(1, .75);
Click the Go! button in the IDE or press the Ctrl and G keyboard keys to make the program execute. Figure 16.1 shows the results.
Figure 16.1. A ...
Get Building Parsers with Java™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.