Monika Galińska
Monika Galińska

Reputation: 201

How to pop Object from array in Julia, by his refrences

I'm trying to delete a specific object from the array

I have an array with Objects Family, defined by me

A =[Family(), ....]

I implement function minimum so that i can pass array A and get a Object

family = minimal(A)

and i next want to delete this object from array A

pop!(A , family)

I received error pop! has no method matching pop!...

I search for correct pop method version but i find nothing, what i can use, any idea how to repair this code?

Upvotes: 2

Views: 498

Answers (1)

Gnimuc
Gnimuc

Reputation: 8566

pop! is supposed to pop out the most recently pushed object. In fact, deleteat! is what you were looking for:

deleteat!(A, index)

you can get the index directly from the function minimal, i guess.

Upvotes: 6

Related Questions