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

ListPlot error handling (and NestList needs going over) #1057

Open
rocky opened this issue Aug 8, 2024 · 0 comments
Open

ListPlot error handling (and NestList needs going over) #1057

rocky opened this issue Aug 8, 2024 · 0 comments

Comments

@rocky
Copy link
Member

rocky commented Aug 8, 2024

Description

NestList doesn't check data given it so it can give a Python traceback.

How to Reproduce

Steps to reproduce the behavior.

For Django:

ListPlot[NestList[# + RandomChoice[{+1, -1}] &, 0, 10]]
...
  File "/src/external-vcs/github/Mathics3/mathics-core/mathics/builtin/drawing/plot.py", line 361, in eval
    return eval_ListPlot(
           ^^^^^^^^^^^^^^
  File "/src/external-vcs/github/Mathics3/mathics-core/mathics/eval/plot.py", line 222, in eval_ListPlot
    for j, point in enumerate(seg):
                    ^^^^^^^^^^^^^^
TypeError: 'float' object is not iterable

Expected behavior

An error message like:

ListPlot::lpn: {{}, {{1., 1.}}, {{1., 2.}}, {}}
     is not a list of numbers or pairs of numbers.

Additional context

Many of thte example https://www.wolfram.com/language/elementary-introduction/3rd-ed/27-applying-functions-repeatedly.html fail because our NestList is not handling arguments properly.

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

No branches or pull requests

1 participant