سؤال

I need to find which link among turtle links is the oldest or newest , now I am using a property called , link-order which stores this value for each link and I find it using min-of my-out-links [link-order]

Is there any better way to do this? Without the need to have link-order attribute for all the links?

هل كانت مفيدة؟

المحلول

The only alternative I can think of would be to have a global list of all links, and whenever a link is created, stick it on the end (and remove any nobody entries that have accumulated because of links dying). Then the oldest link is always the first item in the list.

Your original idea seems fine to me too though — neither approach seems obviously superior to the other. I'd probably pick your idea just because it seems a little simpler and less error-prone to code.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top