Questions tagged [language-design]

for questions about the design of the Mathematica language itself

Filter by
Sorted by
Tagged with
4 votes
2 answers
1k views

Module inside Module. Conflict of names in arguments

I have a module which calls number of other smaller helper modules. But those other helper modules are not used by another module, so there is no needed to have them in global context. So I wanted to ...
Nasser's user avatar
  • 143k
4 votes
1 answer
340 views

Why is there a difference when formulating patterns for Select and FirstPosition?

Select[{1, 2, 4, 7, 6, 2}, # > 2 &] Gives {4, 7, 6}. OK! So one should think that the following would work: ...
newandlost's user avatar
4 votes
1 answer
257 views

Differences between minimization functions?

There's more than 20 functions having to do with minimization ...
Adam's user avatar
  • 3,947
4 votes
1 answer
61 views

A natural syntax for a Query that holds

Often I have an unevaluated expression in a RuleDelayed Key-Value pair and subsequently want ...
Ronald Monson's user avatar
4 votes
1 answer
89 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 ...
David Zwicker's user avatar
4 votes
1 answer
204 views

Why even try the semantic constraints, if expression can't match the pattern structure?

This result is unexpected: Trace[MatchQ[{7}, {_?NumberQ, __}], NumberQ] (* -> {{NumberQ[7], True}} *) Why evaluate NumberQ...
Fallible's user avatar
  • 783
4 votes
0 answers
74 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: <...
Juan Mauricio Matera's user avatar
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) ...
Alexey Popkov's user avatar
4 votes
0 answers
97 views

Why is SparseArray atomic?

This answer tells us that functions like ReplaceAll do not straightforwardly work for the entries of sparse arrays because a ...
Jules Lamers's user avatar
  • 1,074
4 votes
0 answers
254 views

Specifying a region of the complex plane [closed]

I can use the following to specify a region of the complex plane. R1=ImplicitRegion[1.0<=Norm[{a+1,b-1}]<=2.0,{a,b}]; RegionMember[R1,{0.5,1}] It would be ...
Ted Ersek's user avatar
  • 7,124
4 votes
0 answers
1k views

DSolve versus DSolveValue [closed]

I've just discovered the new command DSolveValue in Mathematica 10. Is this new command now the preferred instead of DSolve? Is ...
David's user avatar
  • 14.9k
3 votes
2 answers
452 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 ...
Francis Bush's user avatar
3 votes
1 answer
2k views

Why is Euler's number an uppercase "E" and not a lowercase "e"?

Why is Euler's number an uppercase "E" and not a lowercase "e"? Isn't Euler's Number normally expressed with a lowercase "e"?
Tyilo's user avatar
  • 1,545
3 votes
3 answers
157 views

Why Graph does not recognize chains of vertexes like NetGraph

Cross posted on Wolfram Community. Perfect logic: NetGraph[{1, 1, 1}, {1 -> 2 -> 3}] But this does not make sense: ...
Fortsaint's user avatar
  • 2,060
3 votes
1 answer
83 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 ...
Rene Duchamp's user avatar
  • 1,419
3 votes
3 answers
123 views

Orderless storage of tabulated function values

I would like to elaborate on my previous question Function of arguments given in non-fixed order and a relevant related one Best practice of passing a large number of parameters to functions I find ...
Rho Phi's user avatar
  • 1,420
3 votes
1 answer
166 views

Span starting from the end

I could not find something similar. Given, e.g. lst = Range[10] (* {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} *) the following gives the reverse of ...
Dimitris's user avatar
  • 4,794
3 votes
1 answer
282 views

Refactoring: Why? When? How?

A good Refactoring can transform a kludgy WL code-base into a thing of pristine coherency but how to do so consistently?
Ronald Monson's user avatar
3 votes
1 answer
187 views

Single argument operator form?

I've heard the explanation that functions like StringDrop[] are varargs and so that is why they do not have an operator form. But when you are only using the ...
user5601's user avatar
  • 3,583
3 votes
1 answer
159 views

Why is left NumberPadding always applied in NumberForm?

I would like to display numbers like 9.0001 and 10.0001 in the fixed-width form of xx.xxxx. ...
ArgentoSapiens's user avatar
3 votes
0 answers
67 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 )
sunil joglekar's user avatar
3 votes
0 answers
146 views

Why is MeshRegion atomic?

I wanted to make some changes inside a MeshRegion today and found that unlike Graphics objects, it can't be done directly ...
vapor's user avatar
  • 7,911
3 votes
0 answers
435 views

Mixing Wolfram Language & WolframAlpha Queries - How robust is it?

The advent of Mathematica in the cloud and linguistic input potentially transforms expectations of the Wolfram Language's programming model and its inherent robustness. An example of this comes form ...
Ronald Monson's user avatar
2 votes
1 answer
199 views

Why does `Position` by default return a list of lists of positions instead of a simple list of positions?

Position[{1,2,3,4,2,3,4,5},2] (* Output: {{2},{5}} *) Why does Position work this way? I understand this form might be ...
Andrew Cheong's user avatar
2 votes
2 answers
197 views

Sets of identical equality/inequalities

So I've used Mathematica for some months, but I never noticed this sort of thing about it, namely: (a > b) == (b < a) which are supposed to be identical ...
kozner's user avatar
  • 283
2 votes
1 answer
252 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 ...
Tempus Nomen's user avatar
2 votes
1 answer
164 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 ...
rocky's user avatar
  • 245
2 votes
1 answer
259 views

DeleteCases not working as expected

I am trying to reproduce the example of Data Cleaning from here. I had to make a slight change in input 13 to ...
Thadeu Freitas Filho's user avatar
2 votes
0 answers
99 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: ...
Niklas Vest's user avatar
2 votes
0 answers
119 views

Why is ComplexQ not available? [closed]

For names = Names["System`*"]; executing the following returns 200 hits. ...
Syed's user avatar
  • 53.7k
2 votes
0 answers
66 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 ...
Ronald Monson's user avatar
2 votes
0 answers
125 views

Areasinus hyperbolicus [closed]

Why is there a function ArcSinh[]? Shouldn't this be called ArSinh, since it is connected with an area and not with the length (...
pawel_winzig's user avatar
  • 1,577
2 votes
0 answers
94 views

Why does Mathematica round numbers in this way where the fractional part is 0.5? [duplicate]

I was trying to comment on sequence https://oeis.org/A047229 in the OEIS, when one of the editors pointed out that the rounding is done wrong in this Mathematica one-liner: ...
Mats Granvik's user avatar
  • 1,159
1 vote
2 answers
155 views

Why can we assign a value to a function that has not been defined yet?

Consider the following snippet, fib[1] = fib[2] = 1; fib[n_Integer] := fib[n - 1] + fib[n - 2] As a newbie, it seems for me, the first line assigns 1 to ...
Display Name's user avatar
  • 2,029
1 vote
2 answers
337 views

inappropriate domain restriction on FromPolarCoordinates?

The only way I can understand the domain restriction on FromPolarCoordinates is as ensuring a round-trip is possible: ...
Alan's user avatar
  • 13.7k
1 vote
1 answer
95 views

Variable substitution like usual maths

So... I'm trying to get some simplifications on equations using own defined variables, but the tries I gave didn't result on what I wanted. The problem: I have 2 variables defined as: ...
bruno henrique's user avatar
1 vote
0 answers
49 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 ...
Jonah's user avatar
  • 121
1 vote
0 answers
118 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 ...
cbartondock's user avatar
1 vote
2 answers
101 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 ...
walid fssm's user avatar
1 vote
0 answers
57 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 ...
thorimur's user avatar
  • 9,010
1 vote
0 answers
141 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 ...
Gravifer's user avatar
  • 862
1 vote
0 answers
88 views

Is there packages can help read, analyze or understand MMA codes? [closed]

Sometimes, I think that it's difficult to learn high level codes, or even when looking back on some long lines of codes I myself had written, espectially when lots of pure-functions was used, so I'm ...
Jerry's user avatar
  • 2,459
1 vote
0 answers
98 views

What's in a Name? [closed]

StringReplacePart["StringReplacePart","At",{14,17}] ... Surely you can't be serious? ... Naming Matters: I think what and how we call things is ...
Ronald Monson's user avatar
0 votes
2 answers
54 views

How to make Mathematica to assemble components we already have like a regular input

Suppose we have the following list: {5, 3} I want to add the -> to the end of the first element in the list in Mathematica ...
Qaher's user avatar
  • 313
0 votes
1 answer
137 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 ...
MeMyselfI's user avatar
  • 1,116
0 votes
0 answers
35 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 ...
Nhan_nht's user avatar
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 ...
Paul B. Slater's user avatar
-1 votes
1 answer
495 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 ...
Syed's user avatar
  • 53.7k

1 2
3