0

How does the official implement a list/tuple of parameters that can be different in type and quantity as a whole?

After re-read @Szabolcs's and @MichaelE2's comments.
Finally, I accepted the suggestion in @Kuba's comment ("tutorial/evaluation") as the "answer" according to @Shredderroy's comment:

the tutorial/evaluation suggestion by @Kuba is the best explanation that the general public can provide since Mathematica is a proprietary system.


Details of the original question:

In particular, RegularPolygon and Plot3D – these two symbols make me most curious:

The lists of parameters accepted by RegularPolygon can be any of the following (can be found at the beginning of the official document):

RegularPolygon[{r, θ}, n]
RegularPolygon[{x, y}, rspec, n]

The lists of parameters of Plot3D can be any of the following:

Plot3D[{…, w[f_i], …}, …]
Plot3D[…, {x, y}∈reg]

Although using any programming language can achieve automatic matching of parameters by defining properties/rules/traits or by pattern matching, I still want to know what the specific implementation of these are by the official.

I am very grateful to you!

ooo
  • 564
  • 3
  • 11
  • The question is not completely clear to me. Can you explain in more details, with more examples? Also, be sure to include everything in the question body (never rely on the title). – Szabolcs Jul 29 '19 at 09:53
  • Please read up on pattern matching and defining functions. http://reference.wolfram.com/language/tutorial/PatternsOverview.html http://reference.wolfram.com/language/tutorial/FunctionsAndProgramsOverview.html – Szabolcs Jul 29 '19 at 10:19
  • @Szabolcs Not like that (I read them two years ago), I am not asking "definition functions" (especially user-defined), but how "the diversity of parameter lists" is implemented inside Wolfram Language. – ooo Jul 29 '19 at 10:30
  • 1
    Is this what you mean? foo[x_Integer]:=1; foo[x_String]:=2] – Kuba Jul 29 '19 at 10:32
  • @Kuba No. Please see my comment right above yours. – ooo Jul 29 '19 at 10:33
  • @ooo isn't my example of 'parameter lists' diverse enough? How about foo[x_Integer, y_Region]:=1; foo[x_String]:=2]? It may be that I am missing the point ofc. – Kuba Jul 29 '19 at 10:35
  • @Kuba I'm not care about: you (as a user) write the code of the function's definition, but confusing on: when passing arguments to the built-in symbols, how does the kernel (language itself) process?? – ooo Jul 29 '19 at 10:39
  • Do you mean you want to know how to achieve this in other programming language? – xzczd Jul 29 '19 at 10:43
  • 1
    Performing 'evaluation', see tutorial/Evaluation. – Kuba Jul 29 '19 at 10:43
  • 1
    The long comment thread illustrates well why this was not a clearly written question (BTW the title is still not decoupled)... – Szabolcs Jul 29 '19 at 11:31
  • 2
    Interesting. The question was clear to me the moment I read the title. I think the tutorial/evaluation suggestion by @Kuba is the best explanation that the general public can provide since Mathematica is a proprietary system. Based on the description provided in the documentation there, it would not be too hard to suggest reasonable algorithms for implementing the ideas. But as to an authoritative account of the actual algorithms used by the Wolfram engineering team, well, that will probably be hard to come by. – Shredderroy Jul 29 '19 at 12:34
  • 1
    Many WL functions are written at top level; i.e. in WL using definitions just like the user would. This is why changing system variables can be dangerous. – lirtosiast Jul 29 '19 at 13:23
  • 1
  • @Kuba After I read all the comments again, your last comment is the "answer" - thank you very much! And I realized that [duplicate] does exist, but the question that now reference to is not really corresponding (I had misconceived and mischosen it). – ooo Jul 30 '19 at 05:01

0 Answers0