Contains vs is in

Ali Lloyd ali.lloyd at livecode.com
Wed Jan 4 05:22:31 EST 2017


Peter has pointed out that I am technically using the word 'subsequence' in
error, and should probably have used 'substring' instead!
(cf https://en.wikipedia.org/wiki/Subsequence vs
https://en.wikipedia.org/wiki/Substring)

On Wed, Jan 4, 2017 at 10:16 AM Ali Lloyd <ali.lloyd at livecode.com> wrote:

> 'contains' and 'is in' are implemented exactly the same in LiveCode
> Script, so there shouldn't be any difference. However there is an
> interesting subtlety that emerges when you consider what these two bits of
> syntax should do, which explains why they are different in LCB.
>
> When we say 'A contains B' where A is some sort of sequence (ordered set),
> then I would argue we really mean that B is a subsequence of A. On the
> other hand I think the interpretation of 'is in' is the same as that of 'is
> among the elements of'.
>
> Thus 'contains' is actually a relation between sequences and sequences,
> whereas 'is in' is one between elements and sequences. This makes no
> difference in LCS for strings because the type of the sequence is the same
> as the type of the element, namely they are strings. However it does mean
> that the following two should be considered anomalous:
>
> 1) In LCS, 'is in' does not restrict the left hand side to a single char
> 2) In LCS, no string other than empty 'contains' empty
>
> Both of these anomalies are rectified in LCB. The situation becomes
> clearer when using an LCB list, where <list> contains <string> is a syntax
> error, and <listA> is in <listB> is only true if listA occurs as an
> *element* of listB, rather than a subsequence. Moreover <list> contains []
> is always true.
>
>
> tl;dr - there should be no performance difference between 'contains' and
> 'is in' in LCS.
>
>
> On Tue, Jan 3, 2017 at 11:35 PM Bob Sneidar <bobsneidar at iotecdigital.com>
> wrote:
>
> I interact with copier interfaces quite a lot and the process of backing
> up the data involves going through various pages and typing what I see
> there into a text file. I have always thought it would be great to write an
> app that can do it for me, but I have never been able to scrape anything
> more than the HTML text displayed on the page.
>
> I will have to look into ways to use Javascript to do it. If it requires
> already knowing what the values are though, I'm afraid I might meet with
> unsurpassable difficluty.
>
> Bob S
>
>
> On Jan 3, 2017, at 15:02 , Mike Kerner <MikeKerner at roadrunner.com<mailto:
> MikeKerner at roadrunner.com>> wrote:
>
> the short answer is "yes", but it can be more complicated as it may require
> some javascript execution to pull the data from the server.  It depends on
> the site you are scraping.  You can also (possibly) use a service that can
> yank that for you.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list