2 ms·
I wouldn't say this is unique to Mathematica e.g. it strongly resembles string streams in C++ or the canvas context in HTML/JS or terminal sequences or many oth
by zamadatix 3y ago
I wouldn't say this is unique to Mathematica e.g. it strongly resembles string streams in C++ or the canvas context in HTML/JS or terminal sequences or many others. They aren't truly arguments in the normal sense, it's a more a single argument which is list of commands where "now draw this shape" is one possibility for a command.
- jonahx 3y agoI agree this appears to be the intended mental model. But if that is the case, I'd expect all the arguments to be of some type like "Command", which is not the case here. These expected objects have types like RGBColor or Cuboid or Circle. So it's a list of heterogenous types, which are interpreted as a series of commands... odd. Perhaps instead of thinking of this as a function, I should think of it as a mini DSL for constructing graphics.
- LegionMammal978 3y agoI'd say it's a bit more involved than a single command stream: you can include any number of nested lists inside the outermost list, and each list acts as its own self-contained scope for configuring the style. For instance, if you write Graphics[{Red, Disk[{-2, 0}], {Green, Disk[{0, 0}]}, Disk[{2, 0}]}], you'll get a green disk surrounded by two red disks. Often, when I'm constructing a long Graphics call, I won't have any commands at all in the top-level list, but instead put each part in an isolated sublist.