Contains vs is in

2016-12-30 Thread J. Landman Gay
Did someone once say that between "contains" and "is in", one is faster 
than the other?


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread Mark Talluto
> On Dec 30, 2016, at 2:32 PM, J. Landman Gay  wrote:
> 
> Did someone once say that between "contains" and "is in", one is faster than 
> the other?

This is a great question. One of the engineers on the LC team would be needed 
to answer this one.

Best regards,

Mark Talluto
livecloud.io
canelasoftware.com




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread hh
> Jacqueline L.G. wrote:
> > Did someone once say that between "contains" and "is in", one is faster
> > than the other?

Mark T. wrote:
> This is a great question. One of the engineers on the LC team would be
> needed to answer this one.

There is a real big difference: "is in" are 5 chars and "contains" are 8
chars to type. This means, the second variant needs 60% more time and bytes.

Flock makes also muck ;-)

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread Richard Gaskin

Mark Talluto wrote:

>> On Dec 30, 2016, at 2:32 PM, J. Landman Gay wrote:
>>
>> Did someone once say that between "contains" and "is in",
>> one is faster than the other?
>
> This is a great question. One of the engineers on the LC team would
> be needed to answer this one.

Or you could test it:

on mouseUp
   put 100 into n

   put the millisecs into t
   repeat n
  put ("this is a string with foo in it" contains "foo") into r2
   end repeat
   put the millisecs - t into t2

   put the millisecs into t
   repeat n
  put ("foo" is in "this is a string with foo in it") into r1
   end repeat
   put the millisecs - t into t1

   put t1 && t2
end mouseUp

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread hh
[There is always some crazy time overcrossing here, I posted half an hour 
before you.]

I have here the following result with your code (in average).

There is a "contains"-repeat and a "is in"-repeat.
If I use one as first and the other as second repeat loop I get that the one 
that is called first is a little bit faster ...

Isn't it that deep in the stomach of LC both use the same offset(substring, 
string) routine?

Richard G. wrote:
> Or you could test it:
> 
> on mouseUp
> put 100 into n
> 
> put the millisecs into t
> repeat n
>put ("this is a string with foo in it" contains "foo") into r2
> end repeat
> put the millisecs - t into t2
> 
> put the millisecs into t
> repeat n
>put ("foo" is in "this is a string with foo in it") into r1
> end repeat
> put the millisecs - t into t1
> 
> put t1 && t2
> end mouseUp



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread Richard Gaskin

hh wrote:

> There is a "contains"-repeat and a "is in"-repeat.
> If I use one as first and the other as second repeat loop I get that
> the one that is called first is a little bit faster ...
>
> Isn't it that deep in the stomach of LC both use the same
> offset(substring, string) routine?

I would imagine so.

If not, perhaps they should.  I can't think of a case where they would 
need to produce different results.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread J. Landman Gay

On 1/2/17 4:44 PM, Richard Gaskin wrote:

hh wrote:


There is a "contains"-repeat and a "is in"-repeat.
If I use one as first and the other as second repeat loop I get that
the one that is called first is a little bit faster ...

Isn't it that deep in the stomach of LC both use the same
offset(substring, string) routine?


I would imagine so.

If not, perhaps they should.  I can't think of a case where they would
need to produce different results.



They come out the same for me, but I vaguely remember someone said they 
perform differently. Maybe I'm thinking of something else.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread hh
But there is interestingly the fact that both are faster than

put offset("foo","this is a string with foo in it") > 0 into r3

(seen by 'enlarging' your test).
Quite clear because "is in" and "contains" do the ">0" test in the engine, 
while the above needs a further comparison of two numbers:

put offset("foo","this is a string with foo in it") into r3
without checking the function return is fastest.

I wasn't aware of that, good to know, "is in"/"contains" is 10% faster than 
"offset() > 0".

[And once again: LC 6 is here 2.5 times faster than LC 9 using your test.]
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread Richard Gaskin

hh wrote:

> I wasn't aware of that, good to know, "is in"/"contains" is 10%
> faster than "offset() > 0".

But as with many benchmarks, it's helpful to keep the absolute times in 
mind.


In my quickie test script I had to use 1,000,000 iterations just to get 
any appreciable duration to test.


10% of a fraction is a nanosecond isn't much to lose sleep over. :)

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-02 Thread Mike Kerner
says the guy who doesn't scrape.

On Mon, Jan 2, 2017 at 6:14 PM, Richard Gaskin 
wrote:

> hh wrote:
>
> > I wasn't aware of that, good to know, "is in"/"contains" is 10%
> > faster than "offset() > 0".
>
> But as with many benchmarks, it's helpful to keep the absolute times in
> mind.
>
> In my quickie test script I had to use 1,000,000 iterations just to get
> any appreciable duration to test.
>
> 10% of a fraction is a nanosecond isn't much to lose sleep over. :)
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  
>  ambassa...@fourthworld.comhttp://www.FourthWorld.com
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-03 Thread Richard Gaskin

?

--
 Richard Gaskin
 Fourth World Systems

Mike Kerner wrote:


says the guy who doesn't scrape.

On Mon, Jan 2, 2017 at 6:14 PM, Richard Gaskin wrote:


hh wrote:

> I wasn't aware of that, good to know, "is in"/"contains" is 10%
> faster than "offset() > 0".

But as with many benchmarks, it's helpful to keep the absolute times in
mind.

In my quickie test script I had to use 1,000,000 iterations just to get
any appreciable duration to test.

10% of a fraction is a nanosecond isn't much to lose sleep over. :)



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-03 Thread hh
I think he means

10% of 1/100 of 1,000,000 iterations of a nano-million-dollar are 1 dollar.

> Richard Gaskin wrote:
> ?
>> Mike Kerner wrote:
>> > says the guy who doesn't scrape.
>> >
>> > On Mon, Jan 2, 2017 at 6:14 PM, Richard Gaskin wrote:
>> >
>> >> hh wrote:
>> >>
>> >> > I wasn't aware of that, good to know, "is in"/"contains" is 10%
>> >> > faster than "offset() > 0".
>> >>
>> >> But as with many benchmarks, it's helpful to keep the absolute times in
>> >> mind.
>> >>
>> >> In my quickie test script I had to use 1,000,000 iterations just to get
>> >> any appreciable duration to test.
>> >>
>> >> 10% of a fraction is a nanosecond isn't much to lose sleep over. :)

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-03 Thread Mike Kerner
I mean if you do web scraping and use LC to analyze the results, a million
is a small number.

On Tue, Jan 3, 2017 at 2:34 PM, hh  wrote:

> I think he means
>
> 10% of 1/100 of 1,000,000 iterations of a nano-million-dollar are 1 dollar.
>
> > Richard Gaskin wrote:
> > ?
> >> Mike Kerner wrote:
> >> > says the guy who doesn't scrape.
> >> >
> >> > On Mon, Jan 2, 2017 at 6:14 PM, Richard Gaskin wrote:
> >> >
> >> >> hh wrote:
> >> >>
> >> >> > I wasn't aware of that, good to know, "is in"/"contains" is 10%
> >> >> > faster than "offset() > 0".
> >> >>
> >> >> But as with many benchmarks, it's helpful to keep the absolute times
> in
> >> >> mind.
> >> >>
> >> >> In my quickie test script I had to use 1,000,000 iterations just to
> get
> >> >> any appreciable duration to test.
> >> >>
> >> >> 10% of a fraction is a nanosecond isn't much to lose sleep over. :)
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-03 Thread Richard Gaskin
Thanks. I've been accused of over-obsessing about performance so often 
that it didn't occur to me my comment could be seen as erring the other 
way. :)


I've done scraping, but fortunately here the simplest syntax is also the 
more efficient.


And even in tasks requiring fewer than a million iterations, it's often 
helpful to adopt habits that favor performance.


I like to think of it as the opposite of technical debt, a sort of 
savings account from which you can later draw clock cycles for new 
features or more thorough error-checking as needed.


But on balance, for all the benchmarking I've done over the years I try 
to remain mindful of the ROI of such efforts.


Sometimes it's quite high and well worth it.  Other times, not so much.

Some optimizations come at a cost not only to initial development as 
various options are explored, but also to ongoing maintenance. 
Sometimes highly-optimized code is really hard to read, and harder to 
fix or extend.


With any quantification, percentages are only part of a complete 
breakfast.  I find it helpful to keep absolute values in mind as well.


--
 Richard Gaskin
 Fourth World Systems


hh wrote:

> I think he means
>
> 10% of 1/100 of 1,000,000 iterations of a nano-million-dollar are 1
> dollar.
>
>> Richard Gaskin wrote:
>> ?
>>> Mike Kerner wrote:
>>> > says the guy who doesn't scrape.
>>> >
>>> > On Mon, Jan 2, 2017 at 6:14 PM, Richard Gaskin wrote:
>>> >
>>> >> hh wrote:
>>> >>
>>> >> > I wasn't aware of that, good to know, "is in"/"contains" is 10%
>>> >> > faster than "offset() > 0".
>>> >>
>>> >> But as with many benchmarks, it's helpful to keep the absolute 
times in

>>> >> mind.
>>> >>
>>> >> In my quickie test script I had to use 1,000,000 iterations just 
to get

>>> >> any appreciable duration to test.
>>> >>
>>> >> 10% of a fraction is a nanosecond isn't much to lose sleep over.
>>> >> :)


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-03 Thread Bob Sneidar
Speaking of which, is it possible to scrape values from web controls like menus 
and check boxes?

Bob S


On Jan 3, 2017, at 12:12 , Mike Kerner 
mailto:mikeker...@roadrunner.com>> wrote:

I mean if you do web scraping and use LC to analyze the results, a million
is a small number.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-03 Thread Mike Kerner
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.

On Tue, Jan 3, 2017 at 4:05 PM, Bob Sneidar 
wrote:

> Speaking of which, is it possible to scrape values from web controls like
> menus and check boxes?
>
> Bob S
>
>
> On Jan 3, 2017, at 12:12 , Mike Kerner  mikeker...@roadrunner.com>> wrote:
>
> I mean if you do web scraping and use LC to analyze the results, a million
> is a small number.
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-03 Thread Bob Sneidar
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 
mailto:mikeker...@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-04 Thread Ali Lloyd
'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  contains  is a syntax error,
and  is in  is only true if listA occurs as an *element* of
listB, rather than a subsequence. Moreover  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 
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  mikeker...@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@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-04 Thread Ali Lloyd
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  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  contains  is a syntax
> error, and  is in  is only true if listA occurs as an
> *element* of listB, rather than a subsequence. Moreover  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 
> 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  mikeker...@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@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-04 Thread Mike Kerner
WHAT?
There is some subtlety that I am missing, Ali.

On Wed, Jan 4, 2017 at 5:22 AM, Ali Lloyd  wrote:

> 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  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  contains  is a
> syntax
> > error, and  is in  is only true if listA occurs as an
> > *element* of listB, rather than a subsequence. Moreover  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  >
> > 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  mailto:
> > mikeker...@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@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-04 Thread Ali Lloyd
As an example, consider a list ["a", "b", "c"]. "a" is in the list. But the
list ["a", "b"] is *not* in the list, as it is not an element of the list -
all the elements of the list are strings, and ["a", "b"] is a list.
However, ["a", "b", "c"] *does* contain ["a", "b"] as the latter occurs as
a 'substring' (in the sense of the wikipedia links I posted).

On Wed, Jan 4, 2017 at 1:39 PM Mike Kerner 
wrote:

> WHAT?
> There is some subtlety that I am missing, Ali.
>
> On Wed, Jan 4, 2017 at 5:22 AM, Ali Lloyd  wrote:
>
> > 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 
> 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  contains  is a
> > syntax
> > > error, and  is in  is only true if listA occurs as an
> > > *element* of listB, rather than a subsequence. Moreover  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 <
> bobsnei...@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  > mailto:
> > > mikeker...@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@lists.runrev.com
> > > Please visit this url to subscribe, unsubscribe and manage your
> > > subscription preferences:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>and did a little diving.
> And God said, "This is good."
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-04 Thread hh
(LC Builder 'contains' vs 'is in')
=
TMHO this abstract writing of Ali's examples is easy to remember,
the different "level" of the comparison is visible by the brackets.

x "is in" A if and only if A "contains" [x].
(x "is in" A and y "is in" A) if and only if A contains [x,y].
etc.
where A is a list, x,y is any.


>> Definitions. Let A and B be lists.
>> x "is in" A if and only if x is an element of A.
>> B "contains" A if and only if every element of A "is in" B.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-04 Thread hh
(LC Builder 'contains' vs 'is in')
=
Ali, are the following TRUE statements?

1. Every list "contains" the empty list.
2. [x] "contains" [x, x].
3. nothing "is in" the empty list.

> (Corrected in line 5 contains to "contains"):
> TMHO this abstract writing of Ali's examples is easy to remember,
> the different "level" of the comparison is visible by the brackets.
> 
> x "is in" A if and only if A "contains" [x].
> (x "is in" A and y "is in" A) if and only if A "contains" [x,y].
> etc.
> where A is a list, x,y is any.
> 
> 
> >> Definitions. Let A and B be lists.
> >> x "is in" A if and only if x is an element of A.
> >> B "contains" A if and only if every element of A "is in" B.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Contains vs is in

2017-01-04 Thread hh
Please forget my last two posts, they contain wrong statements.
Haven't seen that this is already implemented using the term "subsequence of 
elements":

>From the dictionary.
Target contains Needle if and only if the elements of Needle occur as a 
_subsequence of the elements_ of Target.

So I should use the dictionary and can test by myself.
I thought erroneously of analogies to (counted) sets, sorry.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode