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

GeneralUtilities #402

Open
3 of 4 tasks
maxitg opened this issue Aug 31, 2020 · 1 comment
Open
3 of 4 tasks

GeneralUtilities #402

maxitg opened this issue Aug 31, 2020 · 1 comment
Assignees
Labels
help wanted Extra attention is needed refactor Does not change functionality, but makes the code better organized or more readable wolfram language Requires Wolfram Language implementation

Comments

@maxitg
Copy link
Owner

maxitg commented Aug 31, 2020

The problem

The build-in GeneralUtilities package seems to have a lot of useful functionality, and we don't currently use it in SetReplace. If we can be reasonably sure that it's not going to break in the future Wolfram Language version, we should start using it.

  • Add GeneralUtilities dependency.

Examples

Some examples where it can be useful (feel free to add more):

Scope (and ModuleScope)

Scope allows one to have local variables (like Block or Module). However, it detects them automatically (at definition time), so that they don't have to be manually tracked. This will reduce potential mistakes due to the mismatch of lists of Module variables, and will make the code simpler. This will eliminate the need for a linter to do that.

KeyAddTo (and KeyUnionTo, KeyPrependTo, KeyAppendTo, KeyJoinTo)

KeyAddTo assumes a default value of 0 for non-existing keys, and will also return the new value.
It is useful, for example, in deleteFromVertexIndex in setSubstitutionSystem$wl.m, where the Scan function can simply be replaced with

If[KeyAddTo[index, #, -1] === 0, index[#] =. ] 
  • Add KeyAddTo where relevant.

SetUsage

SetUsage has significantly more features than usageString, see ? SetUsage.

@maxitg maxitg added help wanted Extra attention is needed refactor Does not change functionality, but makes the code better organized or more readable wolfram language Requires Wolfram Language implementation labels Aug 31, 2020
@taliesinb taliesinb self-assigned this Oct 11, 2020
@taliesinb
Copy link
Collaborator

taliesinb commented Oct 11, 2020

  • Update the guidelines in .github/CONTRIBUTING.md to mention Scope and ModuleScope instead of With and Module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed refactor Does not change functionality, but makes the code better organized or more readable wolfram language Requires Wolfram Language implementation
Projects
None yet
Development

No branches or pull requests

2 participants