Comments (10)
I am working on it. I hope to have it later today.
from mathics-core.
From a pure programming standpoint, you don't add try
unless the access where the error is being called is out of your control and breaks modularity.
It sounds like a good high-level solution is something more along the lines about checking whether the lhs is a protected function as you observe rather than a more low-level solution about whether some sort of element is compound or not.
from mathics-core.
From a pure programming standpoint, you don't add
try
unless the access where the error is being called is out of your control and breaks modularity.It sounds like a good high-level solution is something more along the lines about checking whether the lhs is a protected function as you observe rather than a more low-level solution about whether some sort of element is compound or not.
Since the error is the missing leaves
, could be possibie to inizialize an empty leaves, so process_assign_n() function exercutes without error?
from mathics-core.
@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed def = 1
.
I believe this should be something like the following:
if not lhs.hasattr("leaves"):
return evaluation.warning("You really shouldn't do this")
(warning: pseudo-code above)
from mathics-core.
@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed
def = 1
.
As far as I tried it happens only with N, if I run e.g. If=1
I get correctly "Set::wrsym: Symbol If is Protected."
To get the same result with N
I had to comment all lines which call leaves attribute. I don't know the difference in implementation, but initializing leaves would do the job (despite it be an ugly workaround)
from mathics-core.
@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed
def = 1
.As far as I tried it happens only with N, if I run e.g.
If=1
I get correctly "Set::wrsym: Symbol If is Protected." To get the same result withN
I had to comment all lines which call leaves attribute. I don't know the difference in implementation, but initializing leaves would do the job (despite it be an ugly workaround)
@adamantinum with "do the job" it lets the user assign or show the warning? Anyway, if you could make a PR to we test, that'd be great.
@rocky @mmatera this is showing that something is really wrong, N should be like any symbol. I don't know even the place to look for this, do you have an idea?
from mathics-core.
@adamantinum I'm not sure if that makes sense, if I understand correctly this is happening with only special symbols, and they really shouldn't be re-assigned because the core of Mathics uses them, for example, any type of graphics would not work without N, it is kinda like if Python allowed
def = 1
.As far as I tried it happens only with N, if I run e.g.
If=1
I get correctly "Set::wrsym: Symbol If is Protected." To get the same result withN
I had to comment all lines which call leaves attribute. I don't know the difference in implementation, but initializing leaves would do the job (despite it be an ugly workaround)@adamantinum with "do the job" it lets the user assign or show the warning? Anyway, if you could make a PR to we test, that'd be great.
@rocky @mmatera this is showing that something is really wrong, N should be like any symbol. I don't know even the place to look for this, do you have an idea?
It means it returns the warning N is a protected symbol, as it does for any other Mathics symbol.
I'll try to make a PR, after I'll have understood how leaves attribute works and is defined
from mathics-core.
That's perfect, with the PR it works as it should do. Is there a reason why N behaves differently from other Symbols?
@TiagoCavalcante regarding the place where looking for things like that, isn't there a manual or a scheme of how mathics code is organized?
from mathics-core.
@adamantinum yes, there is buy it isn't that complete, anyway that isn't necessary as mmatera fixed it.
from mathics-core.
@adamantinum yes, there is buy it isn't that complete, anyway that isn't necessary as mmatera fixed it.
Yes, I've seen the PR.
I'm interested in the manual mostly regarding future contributions.
from mathics-core.
Related Issues (20)
- Consider replacing Namespaces.xml with a free version HOT 1
- Max Recursion in Flat attribute testing using CPython
- test_strings.py::test_string_split fails when building on Fedora HOT 1
- test_evaluation.py::test_system_specific_long_integer fails on s390x HOT 9
- DRY and improve the documentation on the code doing translations to sympy back and forward HOT 2
- Improve `Solve` on the `Integers` domain to use SymPy's diophantine solver
- Add `ComplexExpand`
- Implies symbol not properly shown
- Exception in comparison
- Go over Operator Precedence
- Can mathics-core be used as a library? HOT 2
- test_image fails HOT 4
- Implement module level (and possibly class-level) loading
- Unexpected MathicsSession warnings HOT 12
- Implementation of Missing Functions in Mathics HOT 5
- Support for Mathematica's Notation.m package HOT 1
- (sympy 1.12) test_calculus fails with AssertionError: Issue 208 HOT 9
- Assignments with (named) Patterns in the lhs HOT 5
- Parsing hexadecimal characters HOT 1
- EvenQ summary text is not correct? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathics-core.