Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categorize functions in std.math #2567

Merged
merged 1 commit into from Oct 1, 2014
Merged

Categorize functions in std.math #2567

merged 1 commit into from Oct 1, 2014

Conversation

markisaa
Copy link
Contributor

Add a table to std.math so that the functions/constants are categorized similarly to std.algorithm.

I intend to ramp this up and perform similar modifications across the board assuming this gets positive feedback.

https://issues.dlang.org/show_bug.cgi?id=13555

Precedent: 7fdfa02

Results:

@andralex
Copy link
Member

Nice, thanks! cc @ibuclaw

@@ -1,6 +1,53 @@
// Written in the D programming language.

/**
<script type="text/javascript">inhibitQuickIndex = 1</script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add this to std.ddoc:

SCRIPT = <script type="text/javascript">$0</script>

then use it on this line like so:

$(SCRIPT inhibitQuickIndex = 1;)

Thanks! That way we won't get the PDF generation messed up.

@quickfur
Copy link
Member

Thanks for doing this!!

@quickfur
Copy link
Member

I suggest to merge the "classics" and "trigonomery" categories into a single section, perhaps call it "standard mathematical functions". I don't see much point in singling out things like sqrt or cbrt into its own category.

Also, in English it's more common to use the terms "exponentiation & logarithm" rather than "exponents".

I would break up the "miscellaneous" section into "Hardware control", and move poly and conj into one of the other sections. I'm not 100% sure what to do with conj, since we're supposed to be deprecating built-in complex types, so any operation specific to complex numbers really should be in std.complex instead. I notice also that sin, cos, exp, etc., have complex overloads. Perhaps these should cease being documented (but leave it in the code to avoid breaking existing user code)? std.complex ought to take over these overloads anyway.

In the meantime, though, perhaps conj can be put into a "complex numbers" category, where sin, cos, etc., will also be put (I don't think it's a problem for the same functions to appear in multiple categories if they belong to multiple categories).

Finally, it's probably a good idea to put the "constants" section at the top, instead of somewhere in the middle where it's not so obvious to find.

@markisaa
Copy link
Contributor Author

@quickfur - Thanks for the feedback :). Here's my thoughts:

  1. The separation of classics/trigonometry is not there to separate out sqrt and cbrt but rather to recognize that trigonometry is its own rightful category. It certainly has enough stuff in it to warrant it. I'm opposed to this merger. On the bright side, this gives me somewhere to move poly.
  2. My task here is not to reorganize the contents of the files. That can be done as a separate diff with its own concise purpose. The goal here is to make it easier to find what exists today.
  3. When I Google I find that the terms exponents, exponentials, and exponentiation are all equally prevalent in headers to math tutorials (searching for "X and logarithms"). I actually find that exponentiation shows up least. I don't actually care which one we use, so if you want me to use exponentiation, that's fine, but English is my first language and that strikes me as less natural/terse.

The hardware control category, complex numbers category, and rearranging of constants section sound reasonable. I intend to push revisions by end of day.

@markisaa
Copy link
Contributor Author

markisaa commented Oct 1, 2014

Made the requested changes. @andralex - Made the PR for std.ddoc dlang/dlang.org#668 and changed std/string.d so that it also uses this new macro.

@andralex
Copy link
Member

andralex commented Oct 1, 2014

Pulled that, @quickfur are we in good shape?

@quickfur
Copy link
Member

quickfur commented Oct 1, 2014

Yes, let's do it. We can do cleanups later if necessary.

@quickfur
Copy link
Member

quickfur commented Oct 1, 2014

Auto-merge toggled on

quickfur pushed a commit that referenced this pull request Oct 1, 2014
Categorize functions in std.math
@quickfur quickfur merged commit 8e1633e into dlang:master Oct 1, 2014
@ibuclaw
Copy link
Member

ibuclaw commented Oct 2, 2014

@andralex looks good to me %-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants