Is there way to remove element from list in Mathematica -
is there function in wolfram mathematica removing element original list? example
a={1,2,3}; deletefrom[a,1]; a={2,3}
if absent can give example of efficient variant of such function? (i know there function delete() create new list. not if list big)
if want drop first element list a
statement
drop[a,1]
returns list same a
without first element. note not update a
. assign result a
, eg
a = drop[a,1]
note delete
doing behind scenes; first making copy of a
without first element, assigning name a
new list, freeing memory used old list.
comparing destructive updates , non-destructive updates in mathematica quite complicated , can take 1 deep system's internals. you'll find lot subject on stack exchange mathematica site.
Comments
Post a Comment