Questions tagged [language-design]
for questions about the design of the Mathematica language itself
148 questions
27
votes
6
answers
1k
views
Is Mathematica adequately improving?
A bit of a loaded question, but in your opinion is Wolfram's team making good progress on improving their software?
I've used Mathematica for almost 10 years now, and honestly I'm personally ...
21
votes
1
answer
286
views
Why are delayed definitions in scoping functions not documented?
As outlined here, := may be used in scoping constructs like With to give delayed definitions, but this is undocumented.
This ...
0
votes
0
answers
39
views
Create auto-completion for Wolfram Entity framework related functions when using with user-defined entity store
I am trying to create autocompletion for my custom entity store, for example in the document of EntityStore
...
47
votes
3
answers
3k
views
What are all the "magic" symbols in the Mathematica language?
Leonid Shifrin once wrote (excerpted):
(Unevaluated) is one of a very few "magic symbols", along with Sequence and <...
1
vote
0
answers
56
views
Why do rules not default to local scope? [closed]
Consider the following:
80 //. a_?EvenQ -> a/2
a = 3
80 //. a_?EvenQ -> a/2
which outputs:
5
3
3/2
I think I understand ...
4
votes
1
answer
90
views
Why was StringRepeat designed so that StringRepeat[s, 0] throws an error?
Update
In version 13.2 StringRepeat[" ", 0] produces an empty string.
I'm wondering about the rationale behind the design decision that leads to the ...
6
votes
1
answer
380
views
Why does Mathematica list the variables in a double integral backwards?
I am an advanced novice Mathematica user and have done a fair amount of single-variable calculus things with it. This semester I am using Mathematica for multi-variate calculus and when I tried to ...
1
vote
0
answers
164
views
Why is the dot operator not just matrix multiplication?
It seems to me Mathematica does not have an inbuilt matrix multiplication operator. The dot operator fails as such, as is even noted under "Possible Issues" in its documentation it ...
19
votes
1
answer
490
views
Programming language prototyping in Mathematica
Are you aware of any projects using the Wolfram language resp. Mathematica as an environment to explore the design of programming languages - in particular languages with a focus on mathematics (...
4
votes
0
answers
77
views
Why does `MakeBoxes` have the HoldAllComplete attribute and ignore it rather than HoldAll?
MakeBoxes has the attribute HoldAllComplete. For a normal function, it would imply that Upvalues should not be taken into account when the expression is evaluated:
<...
7
votes
2
answers
381
views
Why do some functions require its arguments to be in a list while others accept these as a sequence? [closed]
With Midpoint[{{4, -2}, {2, 5}}], the vectors must be in a list.
But with EuclideanDistance[{-2, 2}, {3, -6}], they don't.
These ...
6
votes
1
answer
219
views
What is the difference between OperatorApplied and CurryApplied?
Reading both OperatorApplied & CurryApplied function documentations seems to indicate that they are essentially the same ...
88
votes
4
answers
49k
views
Why round to even integers?
According to the Mathematica help:
Round rounds numbers of the form x.5 toward the nearest even integer.
For example:
Round[{0.5, 1.5, 2.5, 3.5, 4.5}]
gives
...
32
votes
2
answers
3k
views
Why did the Mathematica Language choose term rewriting instead of the Lambda Calculus as its basis?
Now we can see that Church was associated with the Simply Typed Lambda Calculus. Indeed, it seems he explained the Simply Typed Lambda Calculus in order to reduce misunderstanding about the Lambda ...
2
votes
1
answer
313
views
Separating the Numerator & Denominator
It's been years since I last programmed in Wolfram & for the first few days, I felt like I've been feeling around the dark; now that I've mostly forgotten how to code it.
Again, I could be ...
48
votes
3
answers
1k
views
Is FullGraphics an abandoned function? Is there an alternative?
FullGraphics hasn't worked entirely for a long time and the situation appears to be getting worse instead of better. In Mathematica 10.0, 10.1, 11.3, 12.3 up to 13....
4
votes
2
answers
230
views
What should mapping over a number or symbol produce?
I expected it to be an error (i.e., produce an error message), but Map[f,num] is num. Why is this the correct behavior? If it is ...
6
votes
1
answer
150
views
Why Does Subsets[...,{n}] not Output a Packed List, Even Though it Doesn't Unpack?
Assume list is packed.
I expect Subsets[] is a structural operation because it depends on the number of elements, not on what ...
2
votes
1
answer
166
views
How to think about the answer to Rationalize[-11.5, 1]
In the open source Mathematica implementation called Mathics, an issue was raised where Mathics computes Rationalize[-11.5, 1] as -12 rather than Mathematica which ...
1
vote
2
answers
103
views
Please I need help to define a function of two variables (t,x)!
Let's define the following function:
f[t_, x_] = t^2 + t*x*(1 - x)
such that $x \in (0,1)$ and `$t \in (0,0.02)$
The problem is when I want to define the following ...
4
votes
1
answer
331
views
Differences between minimization functions?
There's more than 20 functions having to do with minimization
...
2
votes
0
answers
111
views
Why does Plot function have HoldAll attribute?
I had an odd issue where my plot wasn't drawn correctly when I called it via Plot[Join[fs,gs], (*..*)]. However, these two versions worked:
...
23
votes
1
answer
531
views
What's the difference between these 2 associations?
I have 2 associations similar to these simplified ones:
...
9
votes
0
answers
65
views
Does ArgumentsOptions do anything we couldn't do without it?
ArgumentsOptions was new in version 12.2. I looked at the application on that page, and it makes code very difficult to understand. What if anything does ArgumentsOptions do for us that we couldn't do ...
50
votes
6
answers
4k
views
How could Wolfram Research increase Wolfram Language adoption?
Introduction
Hello, this is a more general question than is typically asked here. However, I chose to post it here because this seems to be the most active community for Wolfram Language / Mathematica ...
2
votes
0
answers
119
views
Why is ComplexQ not available? [closed]
For names = Names["System`*"]; executing the following returns 200 hits.
...
0
votes
1
answer
533
views
Keywords for the Wolfram Language [closed]
For a programming language, certain keywords are reserved; i.e., these tokens can't be used in any other context while programming in that particular language.
Here is a list of C language keywords ...
44
votes
1
answer
2k
views
What's the deal with next generation Wolfram compiler?
Sources:
Old Compiler (Rob Knapp Nov2011)
Computer Science in Mathematica (Abdul Dakkak Dec2014)
Compilation Technology (Tom Wickham-Jones, Abdul Dakkak & Steve Wilson Dec2015)
The Wolfram ...
9
votes
1
answer
480
views
How to write a simple interpreter / DSL with Wolfram Language?
I am specifically trying to write an interpreter for Mathematica predicates to MongoDB aggregation stages, but I wanted to phrase the question a bit more generically because I can see many times one ...
1
vote
0
answers
59
views
"Compile-time" patterns
If I define a function like
f[x : {_, _Integer}] := (* function body *)
then, as I understand it, every time f[expr] is ...
1
vote
0
answers
152
views
Intervals v.s. Domains: when to use which and why?
or: How to use Interval correctly?
Mathematica provides these constructs for various symbolic deductions tasks. Among those constructs are symbolic number sets ...
0
votes
1
answer
140
views
Is this a bug in Total?
The output from the last of these lines doesn't make sense to me
Total[{}, {1}]
Total[{}, {1, 2}]
Total[{{1}, {1, 1}}, {2}]
Total[{}, {2}]
0
0
{1, 2}
0
The 3 ...
13
votes
2
answers
3k
views
Why did Mathematica choose brackets for function arguments over parentheses?
This is a non-technical question. I'm just curious why Mathematica breaks the convention that parentheses are widely used for function arguments. What's the advantage of ...
0
votes
0
answers
43
views
The command Total sums the entries of a list, is there a comparable command for the product of entries of a list? [duplicate]
I recently just found out about the command Total that gives the sum of a list. Was wondering whether there's an analogue that gives the product of the entries of a list? I see that there is the ...
3
votes
2
answers
481
views
Why are Quantity and Units inconsistent with regular Mathematica behavior?
When I enter this in Wolfram Mathematica V12:
0 Dogs + 5 Cats
Mathematica sensibly returns this:
5 Cats
BUT, if I using the ...
19
votes
1
answer
247
views
Why does OperatorApplied by default reverse the arguments?
Perhaps this is just one of those Mathematica curiosities, but I'd like to know why by default
OperatorApplied[f][x][y] === f[y,x]
versus the more usual way one ...
20
votes
2
answers
6k
views
Why does Mathematica order polynomial forms in reverse from traditional order?
I could very well be missing something obvious, but this has always bugged me with Mathematica and I don't know why it does it or how to fix it.
If I enter any polynomial, say, x^2 + x - 1 for ...
18
votes
2
answers
1k
views
Why it seems that there is no counterpart function as to multiplication, to `Total` as to addition?
Times and Plus have the same grammar, and so do Product and ...
3
votes
0
answers
69
views
what are the principles of good design with Wolfram Language a la Zen of Python? [closed]
The Zen of Python — is a list of 19 general truths for Python design principles.
( https://medium.com/@Pythonidaer/a-brief-analysis-of-the-zen-of-python-2bfd3b76edbf )
27
votes
2
answers
641
views
Version inconsistency with optional arguments: what if the default value doesn't match the pattern?
I just came across some weird behaviour. Take this function definition:
ClearAll[f]
f[vs_List : All] := "match"
The default value of ...
2
votes
0
answers
67
views
Should SubsetMap be called CombineAt?
I'm a big fan of the functionality introduced by SubsetMap but am puzzled as to why it was not called "CombineAt". There are ...
5
votes
1
answer
82
views
Missing["reason"]—can any reason be used?
Can any string be used as a "reason"? Or is there a specific list of acceptable reasons?
For instance,
Missing["refuse"]
works as a missing?
Is there any ...
22
votes
1
answer
643
views
Series vs Asymptotic in 12.1
The functionality of Series and Asymptotic (new in V12.1) is very similar. In fact, they are both listed in the Asymptotics ...
12
votes
2
answers
332
views
ToExpression and ToBoxes aren't inverses of each other?
Applying ToExpression and ToBoxes repeatedly to Hold[1/1] gives many ...
20
votes
2
answers
521
views
Unexpected behaviour when pattern matching with Longest
I came across some unexpected behaviour today when using the Longest function when trying to do some pattern matching.
...
4
votes
0
answers
102
views
Obtain complete list of built-in graphical objects, and split them into groups?
I would like to obtain the complete listing of built-in graphical objects (which can be used in Graphics or Graphics3D) ...
6
votes
1
answer
315
views
when two associations are equal?
<|a -> 2, b -> 3|> == <|b -> 3, a -> 2|> returns False; can anybody explain why? If I am not mistaken ...
8
votes
1
answer
1k
views
Set PlotTheme globally?
Can one set a default PlotTheme globally?
While I recognize one can make lots of workarounds to sort of do this:
Go to ...
9
votes
1
answer
510
views
Why is Reap result nested? [closed]
A minimal (toy) example for my question:
i= 1;
Reap[Do[Sow[i = (i + 1)^2], {4}]]
(* {Null, {{4, 25, 676, 458329}}} *)
I presume the entire result is a ...
3
votes
1
answer
86
views
Understanding how List head works
I am trying to understand how Wolfram Language is actually meant to work and here is something that I fail to understand.
Apply[f, expr] replaces the head of expr by f.
So how come I get different ...