"lineAtOffset"?

Mark Waddingham mark at livecode.com
Fri Oct 30 08:09:32 EDT 2015


On 2015-10-29 22:02, Geoff Canyon wrote:
> I knew there was the possibility that it was vague, so I threw it out 
> there
> without explanation to see -- and it's vague.

It's a useful trick ;)

> I was definitely going for interpretation 2. So my
> 
> item 4 of y matching "a*b"
> 
> would be the same as your
> 
> item 4 of y where it matches "a*b"
> 
> and whatever the syntax, if y were
> 
> "aloft,ahab,about,alob,atob,dog,a flub,ack,a bob,ask,a tomb"
> 
> would return "a flub"

Last night I pondered this for a while and I realized that the reason it 
is 'vague' (well, not entirely clear at first sight in terms of what it 
means at least) is because there are what you might call 'syntactic 
contractions' at play in both of our syntaxes.

Now 'item 4 of y' makes sense - it means treat y as an item-delimited 
list then return the fourth item.

However, if we think about what is 'going on' underneath... Then one 
could rephrase it as:

   item 4 of the items of y

Then, the matching / containing / where stuff becomes an action on the 
list built from y that is subsequently processed:

   the items of y where <expr>
   the items of y containing <string>
   the items of y matching "a*b"

Imagining these forms as returning a list rather than a string, we get 
the syntactic sugar:

   item 4 of y matching "a*b"
     => item 4 of the items of y matching "a*b"
     => item 4 of the items of y where it matches "a*b"

   item 4 of y containing "a"
     => item 4 of the items of y containing "a"
     => item 4 of the items of y where it contains "a"

This at least helps break down what is 'going on' in terms of more 
primitive operations (list building and filtering).

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list