« first day (3288 days earlier)      last day (1186 days later) » 

3:45 PM
@b3m2a1 thanks. Mathematica doesn't seem to give any example with that form in the document.
Btw, can anyone explain the appearance of three "1"s here in the output?
In[1]:= Dimensions[{{{{a, b}}}}]

Out[1]= {1, 1, 1, 2}
 
4:20 PM
@anhnha You've got three nested lists
 
 
1 hour later…
5:49 PM
@anhnha consider that {a} looks like a vector (albeit with a single element), so has dimension 1. Then {{a}} looks like a matrix (albeit with a single element) so has dimensions 2. Then {{{a}}} has 3 dimensions, {{{{a}}}} has 4, etc.
New question:
Is there any facilities in Mathematica for comparing patterns?
That is, not just matching possible instances of a pattern against a pattern, but actually studying a pattern itself to determine (for example) what family of patterns it is?
(I know this sounds vague)
Essentially I want a function where the user input is a pattern, and the function needs to check whether this pattern itself follows a specific paradigm
 
@AntiEarth I mean you can program this up
 
6:25 PM
Pattern matching on patterns should definitely be possible, they're just expressions like everything else, after all.
 
 
1 hour later…
7:40 PM
I naturally think it's possible in principle, but that doesn't lend much help for understanding how to do it. E.g. how to delimit what, in a pattern-of-patterns, is a fixture (of the attemptedly matched pattern) and what is a "top-level" pattern
I take it there are no functions dedicated to making this distinction clearer/easier than (which was my question)
but my intent is actually something slightly harder
which is; I want to, given a pattern as user input, generate all expressions that are instances of that pattern (under some additional constraints). The additional constraints are patterns themselves. So sort of I want to generate every expression that satisfies two patterns
as an example, if the user input pattern was

`_Integer`

and my constraint pattern was

`(0|.5|1|1.5|2)`

then the list of every possible match is

`{0,1,2}`
(clearly the constraints will have to restrict the space to finite matches)
 
8:21 PM
@AntiEarth Concerning patterns, are you aware of Verbatim ?
f[Verbatim[_Integer]] := ok1;
f[_Integer]
--> ok1
f[6]
--> f[6]
(I have Discovered Verbatim in Roman Maeder's book "the mathematica programmer II", in the chapter concerning a Prolog Interpreter implemented with Mathematica.)
 
 
2 hours later…
9:58 PM
@andre314 @AntiEarth you'll be doing a lot of Verbatim. Also look up Pattern and HoldPattern so you understand its many, many variants
 
10:23 PM
why does not this `NearestNeighborGraph[CityData[{Large, "Ohio", "UnitedStates"}]]` work, where as `NearestNeighborGraph[CountryData["SouthAmerica"],
VertexShapeFunction -> "Name"]` works?
 

« first day (3288 days earlier)      last day (1186 days later) »