Bug in index of list

Lindner shared this problem 8 years ago
Answered

Let list1 = {1,2,3} be a list with 3 elements.


In Algebra view: Element[list1,4] is undefined - OK

but

in CAS view: Element[list1,4] = 0 ???


Even Element[list1,-2] = 2 is possible but non meaningful.


496dfb49c839edf9cd8f9f1c91698aef

ggb 4.2.30

Andreas

Comments (1)

photo
1

hi


in effect Element[list1,-2] = 2 is a way to define a list; but , in classic objects libraries, you can define default value;

so you can control the list behavior


i.e.

list1.default := undefined;

element(list1,2):= 2

element(list1,4):=5


so list is { .., undefined, undefined, 2, undefined, 5, undefined, ... }

© 2021 International GeoGebra Institute