Article #1155
Subject: [MOO-coders] index() for LIST
Author: rv
Posted: 8/25/2003 10:59:21 PM
Is there an analog built-in command or available verb that would do similar thing as index() for a STRING but for LIST. That is, it would allow one not to use a for/endfor loop and a if/endif to check if one guy is present in there (if it could also return its position, oh! it would be heaven...;) Thank you;) rv, _______________________________________________ Moo-coders mailing list Moo-coders@nospam http://www.moo-cows.com/mailman/listinfo/moo-coders
Article #1156
Subject: Re: [MOO-coders] index() for LIST
Author: Jag
Posted: 8/25/2003 11:27:14 PM
On Mon, 2003-08-25 at 23:56, rv wrote: > Is there an analog built-in command or available verb that would do > similar thing as index() for a STRING but for LIST. That is, it would > allow one not to use a for/endfor loop and a if/endif to check if one guy > is present in there (if it could also return its position, oh! it would > be heaven...;) > Thank you;) Why yes. It's called in. But its not quite a verb, its a keyword. The syntax is: thing in list and it returns the index of the thing in the list, or 0 if its not found. As an example, do this on a MOO where you have a progbit: ;1 in {0, 1, 2, 3} _______________________________________________ Moo-coders mailing list Moo-coders@nospam http://www.moo-cows.com/mailman/listinfo/moo-coders
Article #1157
Subject: Re: [MOO-coders] index() for LIST
Author: rv
Posted: 8/25/2003 11:38:10 PM
Jag, rohh.. beautiful ;) Mahalo! -rv, ;) > On Mon, 2003-08-25 at 23:56, rv wrote: > > Is there an analog built-in command or available verb that would do > > similar thing as index() for a STRING but for LIST. That is, it would > > allow one not to use a for/endfor loop and a if/endif to check if one guy > > is present in there (if it could also return its position, oh! it would > > be heaven...;) > > Thank you;) > > Why yes. It's called in. But its not quite a verb, its a keyword. The > syntax is: thing in list > and it returns the index of the thing in the list, or 0 if its not > found. As an example, do this on a MOO where you have a progbit: > ;1 in {0, 1, 2, 3} > > _______________________________________________ > Moo-coders mailing list > Moo-coders@nospam > http://www.moo-cows.com/mailman/listinfo/moo-coders > _______________________________________________ Moo-coders mailing list Moo-coders@nospam http://www.moo-cows.com/mailman/listinfo/moo-coders