Sequence and list with mixed object types

slik shared this problem 11 years ago
Answered

Hi,


list1={a,c} contains a segment (a) and arc (c)


Sequence[Element[list1,i],i,1,2] gives {a,?}


Zip[A,A,list1] something went wrong.


Simon

https://ggbm.at/553553

Comments (4)

photo
1

Hi, Element only works if all elements of the list are of the same type and we won't change that.

I doubt we can improve Zip in this way either (internally objects cannot change type, so we would have to create new objects all the time).

photo
1

Thanks,


OK I was trying to use

2*Element[list1,f] where f is a slider


But Element[2*list1,f] works fine.


Simon

photo
1

Hi,


2*list1 converts everything with number value to numbers, so there is no problem with different types. So if you only want to pick the numeric values and ignore their geometrical meaning (area of polygon, length of segment, ...), you can use Element[1*list1,n] or Element[CopyFreeObject[list1],n].


Cheers,

Zbynek

photo
1

Zbynek,


I found that 1*list1 doesn't work, but 2/2*list1 does. So does 0!*list1. :D


Simon

https://ggbm.at/553557

© 2023 International GeoGebra Institute