I knew there was the possibility that it was vague, so I threw it out there without explanation to see -- and it's vague. 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" On Thu, Oct 29, 2015 at 4:25 PM, Mark Waddingham <m...@livecode.com> wrote: > On 2015-10-29 19:47, Geoff Canyon wrote: > >> How about: >> >> line 1 containing x in y >> word 47 containing x in y >> item -3 containing x in y >> > > I must confess I'm not 100% sure of what these mean - I see two > possibilities: > > 1) item Z containing x in y - is the first item after item Z which > contains x where y is the string to search > > 2) item Z containing x in y - the Z'th item containing x where y is the > string to search > > Interpretation (1) is equivalent to the originally proposed > 'itemAtOffset'. (Okay so it was lineAtOffset, but mutatis mutandis). > > Interpretation (2) is something slightly different to what we have now and > perhaps wouldn't easily fit (obviously) into a functional form. > > Adding an index allows for a natural english syntax, a clear result, >> maximum flexibility, and pathological extension, i.e.: >> >> word -2 containing "i" in item 14 containing "test" in line 23 containing >> "index" >> > > Any non-function like syntax would allow stacking naturally as the result > of the expression after the 'in' would be evaluated first, so actions > further to left would evaluate on the substrings produced by those to the > right (of the 'in'). > > (Obviously function versions would stack to, but be nested rather than > left to right). > > This syntax would make it easy to do a more detailed match: >> >> line 4 matching "a*b" in y >> > > I've always quite liked the idea of: > > item 4 of y where it matches "a*b" > > Indeed, that makes me think that you are thinking interpretation (2) above > (please do correct me if I'm wrong). > > Actually, with a 'where' clause, Richard's itemAtOffset function would > become: > > the first item of y where it contains "a" > > In either case (where or containing) I'd be concerned that there is a lack > of clarity of what 'item N ...' means. > > > Warmest Regards, > > Mark. > > -- > Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/ > LiveCode: Everyone can create apps > > _______________________________________________ > 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