Title: RE: exploring LibURL - among vs contains and arrays

Rodney,

Thanks for reminding me about "is among"; I had forgotten that, and had been using a variation of contains in my scripts.This:

     if "Hello" is among the items of myGreetings

is a lot better than:

     if ("," & myGreetings & ",") contains ",Hello,"

or

     if ",Hello," is in ("," & myGreetings & ",")

It's also better for legibility as well.

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rodney Tamblyn
Sent: Monday, August 27, 2001 11:51 PM
To: [EMAIL PROTECTED]
Subject: exploring LibURL - among vs contains and arrays


Thanks Phil, Mark and Scott for the responses to my sockets enquiry


Further to Scott's suggestion I've been looking through the LibURL stack.


Consider amongs vs contains:


newUrl is among the lines of the keys of tQue
"a" is among the words of "a b c d" --> true


vs:


newUrl is in the keys of tQue
the keys of tQue contains newUrl


Among operator matches a specific chunk (eg a word or a line), so is more precise.  Otherwise these commands seem analogous with each other.  Is among faster?  This isn't an operator I use very much but I think perhaps it is superior to using "in" or "contains".  Comments?


Arrays


Further to my earlier post on arrays within arrays:


While is is not possible to do this:


put "seat" into parts[a]
put parts into car[elements]


.... it is possible to do this:


put "seat" into car[elements[a]]
put "wheel" into car[elements[b]]


put car[elements[a]] #-->seat


Limitations:
- You can't retrieve a whole sub-array
put car[elements] into theElements #empty


- The keys won't show elements whose value is a sub-array
put the keys of car #no pun intended!
--> empty      


So one can build multi-dimensional arrays, but cannot put a whole array into an element of another array.


Rodney
--
--
Rodney Tamblyn
Educational Media group
Higher Education Development Centre, 75 Union Place
University of Otago, PO Box 56, Dunedin, New Zealand
ph +64 3 479 7580 Fax +64 3 479 8362
http://hedc.otago.ac.nz ~ http://rodney.weblogs.com

Reply via email to