-
-
Notifications
You must be signed in to change notification settings - Fork 63
Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels