[HN Gopher] Simple Drawings with Mathematica
___________________________________________________________________
Simple Drawings with Mathematica
Author : ingve
Score : 31 points
Date : 2023-09-16 06:45 UTC (1 days ago)
(HTM) web link (leancrew.com)
(TXT) w3m dump (leancrew.com)
| swayvil wrote:
| Consider a set of symbols where all of the symbols in the set can
| be described in terms of other symbols in the set.
|
| There's a name for that in the world of shape-grammar type things
| but I forget what it is.
|
| I think that any such "self describing" set would lend itself to
| being translated to other self describing sets. It might even be
| guaranteed. A neat transform.
|
| A software language could be like that.
|
| We could do a subset of math that is like that.
|
| It's eminently feasible to do a drawing system like that.
| mrkeen wrote:
| I don't know if there's any direct relation but this reminds me
| of:
|
| http://conal.net/talks/denotational-design-lambdajam-2015.pd...
|
| https://www.youtube.com/watch?v=bmKYiUOEo2A
| jonahx wrote:
| Graphics3D[{Gray, phone, Black, Thick, xaxis, yaxis, zaxis},
|
| This has always seemed an odd API to me, in that the arguments
| can alternate between "the objects being drawn" and "stylistic
| configuration params" which act like imperative commands setting
| the current state of the color or whatnot.
|
| With that said, Wolfram as a whole seems well-designed, so I
| wonder if I am missing something deeper, and curious to hear the
| rationale from Wolfram experts.
| lima wrote:
| > which act like imperative commands setting the current state
| of the color or whatnot
|
| No further insights on the design rationale, but yeah, that's
| exactly what's going on.
| zamadatix wrote:
| 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.
| LegionMammal978 wrote:
| I'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.
| jonahx wrote:
| I 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.
___________________________________________________________________
(page generated 2023-09-17 23:01 UTC)