Re: problem with counting words
On Oct 15, 2014, at 11:13 PM, Richard Gaskin wrote: Peter M. Brigham wrote: .. and you don't risk forgetting to reset the itemDelim, which I often forget to do, especially in repeat loops…. As a discrete function it should be okay, since unlike SuperCard in LiveCode the itemdel is a local property. Yes, that's the point. Since the itemdel is local to a handler, by setting it within the function you don't have to reset it in the calling handler. Much simpler. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ 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: problem with counting words
Re extending the itemdelimiter keyword... The handler I posted for getItem() is easily modified to allow the itemdel to consist of a string of characters, so you could do: getItem(a//b//c//d//e//f,4,//) - d So while we're waiting for the language to be expanded, you could use this: function getItem tList,tIndex,tDelim -- returns item # tIndex of tList, given itemdelimiter = tDelim -- could just get item tIndex of tList in the calling handler but --then have to set and restore the itemDelimiter, so this is less hassle -- defaults to tDelim = comma -- also allows tDelim to be a string of characters ! -- requires getDelimiters() if tDelim = empty then put comma into tDelim put getDelimiters(tList) into workingDelim replace tDelim with workingDelim in tList set the itemdelimiter to workingDelim return item tIndex of tList end getItem function getDelimiters tText,nbr -- returns a cr-delimited list of nbr characters --not found in the variable tText -- use for delimiters for, eg, parsing text files, loading arrays, etc. -- usage: put getDelimiters(tText,2) into tDelims --put line 1 of tDelims into lineDivider --put line 2 of tDelims into itemDivider -- etc. if nbr = empty then put 1 into nbr -- default 1 delimiter put 2,3,4,5,6,7,8,16,17,18,19,20 into baseList -- could use other non-printing ASCII values put the number of items of baseList into maxNbr if nbr maxNbr then return Error: max maxNbr delimiters. repeat with tCount = 1 to nbr put true into failed repeat with i = 1 to the number of items of baseList put item i of baseList into testNbr put numtochar(testNbr) into testChar if testChar is not in tText then -- found one, store and get next delim put false into failed put testChar into line tCount of delimList exit repeat end if end repeat if failed then put the number of lines of delimList into nbrFound if nbr = 1 then return Error: cannot get delimiter! else if nbrFound = 0 then return Error: cannot get any delimiters! else return Error: can only get nbrFound delimiters! end if end if delete item i of baseList end repeat return delimList end getDelimiters ___ 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: problem with counting words
On Wed, Oct 15, 2014 at 12:58 AM, Peter Haworth p...@lcsql.com wrote: a=1,b=2,c=3 That's pretty basic and is easily handled by: replace comma with cr Then just work through the lines and the itemDelimiter to =. What I was thinking about was: A,B,C,D etc and being able to specify the chunkDelimiter as , Of course this too could be handled by: replace quote comma quote with cr, but you are left with a leading and trailing . The more real world example is how LC currently defines words. As far as I can tell, using regex syntax, I think LC uses [ \f\n\r\t]+ For those unfamiliar with regex that deciphers to any whitespace chars (carriage return, line feeds, tabs, etc) can appear together as many times as possible, but at least once. That's why LC will correctly count the words in this example, but if the delimter was changed to space, as has been suggested, you'll get seven: put one two three four into tStore --simulate a word being delimited by space set the itemDelimiter to space --item is now equivalent to word put the number of items of tStore A current limitation with itemDelimiter, regardless to what it is set, but lets go with the default comma one , two , three,four If I refer to any of these items, only the 4th will not include white space, all others, and therefore in all my handlers, if I don't want to include the whitespace, then I have: word 1 to -1 of item x of ... Not hard, but it would certainly save a enormous amount of file preprep if I could: set the chunkDelimiter to [space comma quote]+ --one or more of one , two , three,four put chunk 2 would result in 'two' without any whitespace around it. And chunk 1 would be 'one', no leading quote and no trailing space. Having now thought about it a bit, one BIG GOTCHA I see is if multi character chunkDelimiter was implemented then it could behave just like LC words do, and by that I mean you can NOT have an empty word, unlike items which you can. 1,2,3,,, ,,, , 7, ,, --using same chunkDelim as above Is only 4 chucks with no empty chunks between 3 and 7 and no trailing empty chunks after 7. onetwo three seven -- lots of trailing tabs and spaces put empty into word 2 one three seven put two into word 2 one two seven ___ 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: problem with counting words
On Oct 14, 2014, at 12:45 PM, Richard Gaskin ambassa...@fourthworld.com wrote: on mouseUp put 1000 into n put aaa,bbb,ccc#ddd#eee#fff,ggg,hhh into tSomeData -- put the millisecs into t repeat n get nDepth(tSomeData, 3, comma, 2, # ) end repeat put the millisecs - t into t1 put t1/n cr it end mouseUp function nDepth get param(1) repeat with i = 2 to paramCount() step 2 set the itemDel to param(i+1) get item param(i) of it end repeat return it end nDepth That causes an execution error at line 16 when i = 6, and it tries to set the itemDel to empty. After changing repeat with i = 2 to paramCount() step 2 to repeat with i = 2 to paramCount()-1 step 2 it works. -- Dick ___ 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: problem with counting words
There is no way to search the dictionary, but I have made a replacement for it, which can do full searches: http://bjoernke.com/bvgdocu/ As a side note I really wish trueWord would be named humanWord instead, it'd make the distinction to the historic word much more immediate comprehensible. On the plus side, the next such keyword can now be named falseWord, which is nice, I guess. On 12 Oct 2014, at 22:04, la...@significantplanet.org wrote: The other thing I don't understand is this: Is there any way to search the dictionary on the text of the dictionary and not just on the keywords? If there is a way to do that, I don't know how. It would help a lot. On 12 Oct 2014, at 21:37, J. Landman Gay jac...@hyperactivesw.com wrote: BTW, the trueword token was introduced as part of the unicode implementation, so you'll only see it in LC version 7.0. When we all adopt that version, we will be able to choose between the logical word boundaries (trueword) and the historical boundaries (the HyperCard method, which also includes punctuation as part of words.) -- Use an alternative Dictionary viewer: Chat with other RunRev developers: http://bjoernke.com/chatrev/ ___ 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: problem with counting words
On Oct 15, 2014, at 7:18 PM, Peter M. Brigham pmb...@gmail.com wrote: On Oct 14, 2014, at 3:45 PM, Richard Gaskin wrote: function nDepth get param(1) repeat with i = 2 to paramCount() step 2 set the itemDel to param(i+1) get item param(i) of it end repeat return it end nDepth Another one to add to my collection. Thanks, Richard! +1 I don't think I ever knew about the param() function. That can be handy! .Jerry ___ 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: problem with counting words
Peter M. Brigham wrote: .. and you don't risk forgetting to reset the itemDelim, which I often forget to do, especially in repeat loops…. As a discrete function it should be okay, since unlike SuperCard in LiveCode the itemdel is a local property. -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com Follow me on Twitter: http://twitter.com/FourthWorldSys ___ 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: problem with counting words
On Tue, Oct 14, 2014 at 2:03 AM, Peter Haworth p...@lcsql.com wrote: There's a qcc enhancement request out there for a new chunk type (chunk) along with a delimited by clause. On Mon, Oct 13, 2014 at 7:32 AM, Terence Heaford t.heaf...@btinternet.com wrote: set the wordDelim to space set the wordDelim to “*” Initally set to space, resets to space at the end of a handler. Nnnno! What is the point of a chunk or a word if it is only delimited by a single character? It is identical to an item! set the itemDelimiter to space put the number of items into tCount. How is that any different from: put the number of chunks delimited by space of field xyz into tCount OR set the wordDelim to space put the number of words into tCount And the last thing we want is the wordDelimiter to be defaulted to space! That would break so many scripts. The great thing about word and token is they are NOT items. Items are delimited by any single character you want, but that is their limitation, a single character. A word, a trueWord (= LC7) and a token are not delimited by a single character but by a range of one or more characters which have been predefined. If you want something new... a chunk, then the ability to specify it's delimiter as a range of characters that are either single of combined *could* be a valid enhancement. * Haven't really thought about it enough to come up with drawbacks, all I know is I DON'T want the wordDelim to be a space and to create another chunk type that is identical to an item seems counter productive to me. ___ 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: problem with counting words
get char 1 to 7 of word 9 of item x of line y of card field 1”. Al the best Terry On 14 Oct 2014, at 08:45, Kay C Lan lan.kc.macm...@gmail.com wrote: What is the point of a chunk or a word if it is only delimited by a single character? It is identical to an item! ___ 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: problem with counting words
On Tue, Oct 14, 2014 at 12:45 AM, Kay C Lan lan.kc.macm...@gmail.com wrote: If you want something new... a chunk, then the ability to specify it's delimiter as a range of characters that are either single of combined *could* be a valid enhancement. Rather than try to explain the thinking behind delimited by, I'll refer you to the forum discussion at http://forums.livecode.com/viewtopic.php?f=6t=21630p=111222hilit=delimited+by#p111222 and enhancement request at http://quality.runrev.com/show_bug.cgi?id=13557. Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ 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: problem with counting words
That would be a great enhancement. +1 A collection of delimiters(item list?) would be needed to even emulate the current word chunk. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Peter Haworth Sent: Tuesday, October 14, 2014 11:32 AM To: How to use LiveCode Subject: Re: problem with counting words On Tue, Oct 14, 2014 at 12:45 AM, Kay C Lan lan.kc.macm...@gmail.com wrote: If you want something new... a chunk, then the ability to specify it's delimiter as a range of characters that are either single of combined *could* be a valid enhancement. Rather than try to explain the thinking behind delimited by, I'll refer you to the forum discussion at http://forums.livecode.com/viewtopic.php?f=6t=21630p=111222hilit=delimite d+by#p111222 and enhancement request at http://quality.runrev.com/show_bug.cgi?id=13557. Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ 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: problem with counting words
It seems to me that not all list members visit the forums (and vice-versa). I know there was a thread on this subject a while back. However, I think that both are required reading to keep up with current events. Craig Newman -Original Message- From: Ralph DiMola rdim...@evergreeninfo.net To: 'How to use LiveCode' use-livecode@lists.runrev.com Sent: Tue, Oct 14, 2014 12:29 pm Subject: RE: problem with counting words That would be a great enhancement. +1 A collection of delimiters(item list?) would be needed to even emulate the current word chunk. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Peter Haworth Sent: Tuesday, October 14, 2014 11:32 AM To: How to use LiveCode Subject: Re: problem with counting words On Tue, Oct 14, 2014 at 12:45 AM, Kay C Lan lan.kc.macm...@gmail.com wrote: If you want something new... a chunk, then the ability to specify it's delimiter as a range of characters that are either single of combined *could* be a valid enhancement. Rather than try to explain the thinking behind delimited by, I'll refer you to the forum discussion at http://forums.livecode.com/viewtopic.php?f=6t=21630p=111222hilit=delimite d+by#p111222 and enhancement request at http://quality.runrev.com/show_bug.cgi?id=13557. Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ 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 ___ 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: problem with counting words
That’s been fielded before in a post on this list. Some will only use the forum, others only the list. Still others only the digest. It’s a noble goal, and doomed to failure. :-) Bob S On Oct 14, 2014, at 09:33 , dunb...@aol.com wrote: It seems to me that not all list members visit the forums (and vice-versa). I know there was a thread on this subject a while back. However, I think that both are required reading to keep up with current events. Craig Newman ___ 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: problem with counting words
Yeah, I don't think word was considered during the discussion. Multiple delimiters might be a good idea but it feels like you'd have to know which delimiter had been encountered. For example, if you had a string like this: a=1,b=2,c=3 and you wanted to unpack it with: repeat for each item ritem delimited by =, doStuff end repeat You'd probably need to know which delimiter had been encountered to distinguish between the left and right sides of the = character. The main intent behind delimited by was to do away with having to keep resetting the itemdelimiter, e.g repeat for each item rItem1 delimited by = do stuff with ritem1 repeat for each item rItem2 delimited by , do stuff with ritem2 end repeat end repeat Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Tue, Oct 14, 2014 at 9:31 AM, Ralph DiMola rdim...@evergreeninfo.net wrote: That would be a great enhancement. +1 A collection of delimiters(item list?) would be needed to even emulate the current word chunk. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Peter Haworth Sent: Tuesday, October 14, 2014 11:32 AM To: How to use LiveCode Subject: Re: problem with counting words On Tue, Oct 14, 2014 at 12:45 AM, Kay C Lan lan.kc.macm...@gmail.com wrote: If you want something new... a chunk, then the ability to specify it's delimiter as a range of characters that are either single of combined *could* be a valid enhancement. Rather than try to explain the thinking behind delimited by, I'll refer you to the forum discussion at http://forums.livecode.com/viewtopic.php?f=6t=21630p=111222hilit=delimite d+by#p111222 and enhancement request at http://quality.runrev.com/show_bug.cgi?id=13557. Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ 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 ___ 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: problem with counting words
Richard. Right, and I am sure you know this, but it was never particularly a speed issue,rather more a mental and organizational one, that would be even more opaque if you had, say a handful of nested delimiters instead of just two. Craig -Original Message- From: Richard Gaskin ambassa...@fourthworld.com To: use-livecode use-livecode@lists.runrev.com Sent: Tue, Oct 14, 2014 3:46 pm Subject: Re: problem with counting words FWIW, changing the itemdel takes only about 0.00012 ms on a relatively slow (2.16GHz) Mac, and about a third as long (0.43 ms) on my custom Linux box (3.0 GHz). on mouseup put 10 into n -- put the millisecs into t repeat n get 1+1 end repeat put the millisecs - t into t1 -- put the millisecs into t repeat n get 1+1 set the itemdel to # end repeat put the millisecs - t into t2 -- put (t2-t1)/n end mouseup If that would be fast enough for your needs, you could write a function that takes any number of item number/delimiter pairs as arguments, following the data itself: on mouseUp put 1000 into n put aaa,bbb,ccc#ddd#eee#fff,ggg,hhh into tSomeData -- put the millisecs into t repeat n get nDepth(tSomeData, 3, comma, 2, # ) end repeat put the millisecs - t into t1 put t1/n cr it end mouseUp function nDepth get param(1) repeat with i = 2 to paramCount() step 2 set the itemDel to param(i+1) get item param(i) of it end repeat return it end nDepth On my old Mac that takes only about 0.005 ms per call. -- 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 ___ 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: problem with counting words
dunbarx wrote: Right, and I am sure you know this, but it was never particularly a speed issue,rather more a mental and organizational one, that would be even more opaque if you had, say a handful of nested delimiters instead of just two. The speed info I provided wasn't to show that it's fast, but merely that it's not too slow to be used right now. I'll bet with v8's Open Language there would be a way to expand the syntax to make it more xTalk-like, but if anyone here actually needs to work on data with n-depth items this function seems to work well enough to get the job done. -Original Message- ... If that would be fast enough for your needs, you could write a function that takes any number of item number/delimiter pairs as arguments, following the data itself: on mouseUp put 1000 into n put aaa,bbb,ccc#ddd#eee#fff,ggg,hhh into tSomeData -- put the millisecs into t repeat n get nDepth(tSomeData, 3, comma, 2, # ) end repeat put the millisecs - t into t1 put t1/n cr it end mouseUp function nDepth get param(1) repeat with i = 2 to paramCount() step 2 set the itemDel to param(i+1) get item param(i) of it end repeat return it end nDepth -- 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: problem with counting words
Thanks Richard. Yet one more snippet of code in my utility button. That didn’t sound weird, did it? ;-) Bob S On Oct 14, 2014, at 12:45 , Richard Gaskin ambassa...@fourthworld.commailto:ambassa...@fourthworld.com wrote: FWIW, changing the itemdel takes only about 0.00012 ms on a relatively slow (2.16GHz) Mac, and about a third as long (0.43 ms) on my custom Linux box (3.0 GHz). ___ 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: problem with counting words
And I suppose you had to throw them uphill, both ways. That must have been scary. Sort of a rocky horror show. On October 13, 2014 12:26:21 AM CDT, Mark Wieder mwie...@ahsoftware.net wrote: Jacque- Sunday, October 12, 2014, 8:43:34 PM, you wrote: Absolutely. I keep a pile of rocks next to my desk. By the end of winter I've usually run out, and there is too much snow to go get more, so then I start throwing my husband. He has opinions about that. When I started out, all we had were rocks. And we were happy to get them. -- 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: problem with counting words
-Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Mark Wieder Sent: Sunday, October 12, 2014 8:00 PM To: How to use LiveCode Subject: Re: problem with counting words wordDelimiter would be an interesting addition, but would have its own complexities. You need to keep in mind that words are delimited by whitespace: spaces, tabs, carriage returns, etc., but also by some punctuation: commas, periods, semicolons, etc. I also find that text within quotes being a single word is congruent with defining arguments for comandline syntax. -- -Mark Wieder ahsoftw...@gmail.com Also don't forget the non-breaking space Decimal 160. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net ___ 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: problem with counting words
set the wordDelim to space set the wordDelim to “*” set the wordDelim to “any single character you want” Should be easy for the LiveCode programmers to deliver such a command. also put the wordDelim into myVar Initally set to space, resets to space at the end of a handler. All the best Terry On 13 Oct 2014, at 15:23, Ralph DiMola rdim...@evergreeninfo.net wrote: -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Mark Wieder Sent: Sunday, October 12, 2014 8:00 PM To: How to use LiveCode Subject: Re: problem with counting words wordDelimiter would be an interesting addition, but would have its own complexities. You need to keep in mind that words are delimited by whitespace: spaces, tabs, carriage returns, etc., but also by some punctuation: commas, periods, semicolons, etc. I also find that text within quotes being a single word is congruent with defining arguments for comandline syntax. -- -Mark Wieder ahsoftw...@gmail.com Also don't forget the non-breaking space Decimal 160. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net ___ 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: problem with counting words
Good post, Kay. Each of the examples you provided is among the reasons I like xTalk. But even though they demonstrate useful features of the language, neither is dependent on xTalk's trait of counting quoted text as a single word when using the word chunk type. Perhaps I should preface this by noting that I very much enjoy xTalk in general and LiveCode in particular, a love that's only grown in my 27 years with this family of languages. But all programming languages have historical anomalies, and xTalk is not the world's only exception to this. Programming languages are, by nature, somewhat funky, attempting to communicate the richness of human thought to a machine too stupid to count past 1. All of them require trade-offs. In the first example you provided, the list of names, none of them includes quoted text. And even with the broader support of treating words as white-space delimited (breaking from the English rule of usually not including punctuation), as you noted at least one of the examples there will fail (sorry, Mr. Van Damme). Many other languages also provide means of dealing with multi-character white space (sed, awk, and Python come to mind), and none of them, not even xTalk, will reliably sort by last name unless we separate the first and last more explicitly, such in separate fields or with a tab character, as is commonly done in any language where a last-name sort is important, even in LiveCode. In the second example in which a multi-word value is used as an object identifier, once again we're not asked to parse that using xTalk's word chunk type, but instead get to rely on the engine's expression evaluator, which works very much like JavaScript's and others' in which literal strings can be used as object identifiers. Useful as it is, it's neither unique to xTalk nor necessarily dependent on how we use the word chunk type. Object identifiers *can* become dependent on the word chunk type if you need to parse them yourself, as others have noted along with many other good examples to justify the HyperTalk team's implementation (though we might ask why we need to do this so often, such as why we don't have objectType or ownerStack functions). No matter how useful the current implementation is, the choice still requires justification. Even if that justification is sound, favoring a certain utility, it's still a trade-off, the downside being a redefinition of the word word from its more common definition in natural language. Larry's initial confusion is far from rare. xTalk's reliance on a unique definition of word that differs from its use in natural language is something we all had to learn. We may accept it, we may like it, we may even prefer it, but it's by no means intuitive to the native English speaker. xTalk was born more than a decade before Unicode was invented, so it couldn't have taken advantage of the vast pool of collective knowledge embodied in the Unicode spec, nor was there the luxury of having the computational horsepower needed to use such a spec efficiently. Today the LiveCode team has at last corrected this with the introduction of the trueWord token type, though I have to shrug my shoulders with an acknowledging chuckle in sharing Larry's initial observation that if xTalk were being designed today, with it's ostensible emphasis on English-like syntax, the order is backwards: If we didn't have 27 years of code dependent on xTalk's unique redefinition of word, to support the claim of English-like it might be more intuitive to have word act as trueWord does, and have some other token do what word currently does in xTalks unique redefinition. But that's not the world we live in. Like every other language, LiveCode is a product of its unique history. Useful as its conventions are, they will from time to time require us to learn new ways of doing things. This is just one of many reasons I generally don't use the phrase English-like when giving talks on LiveCode. Our favorite language brings to the world's programming choices a uniquely valuable blend of features, but while it's certainly more readable than most it isn't particularly English-like, nor does it really even try all that hard to be. And that's a good thing. Natural language is really tough stuff to parse, full of its own even longer and more nuanced history, and intended for a very different audience (the cognitive complexity of the human mind rather than the logical simplicity of computers). I think most of us (except Geoff Canyon who has a rare mind for this sort of stuff g) would agree that we're all glad this isn't a valid statement in xTalk, even though it's a perfectly valid sentence in English: Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. http://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo :) Kay C Lan wrote: On Mon, Oct 13, 2014 at 7:45 AM,
Re: problem with counting words
When the new language code becomes available I am going to write an extension just for you, Richard... gc On Oct 13, 2014, at 11:03 AM, Richard Gaskin ambassa...@fourthworld.com wrote: I think most of us (except Geoff Canyon who has a rare mind for this sort of stuff g) would agree that we're all glad this isn't a valid statement in xTalk, even though it's a perfectly valid sentence in English: Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. http://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo :) ___ 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: problem with counting words
Hi Richard, in a word... I really enjoyed reading your post and I learned a lot! Larry - Original Message - From: Richard Gaskin ambassa...@fourthworld.com To: use-livecode@lists.runrev.com Sent: Monday, October 13, 2014 9:03 AM Subject: Re: problem with counting words Good post, Kay. Each of the examples you provided is among the reasons I like xTalk. But even though they demonstrate useful features of the language, neither is dependent on xTalk's trait of counting quoted text as a single word when using the word chunk type. Perhaps I should preface this by noting that I very much enjoy xTalk in general and LiveCode in particular, a love that's only grown in my 27 years with this family of languages. But all programming languages have historical anomalies, and xTalk is not the world's only exception to this. Programming languages are, by nature, somewhat funky, attempting to communicate the richness of human thought to a machine too stupid to count past 1. All of them require trade-offs. In the first example you provided, the list of names, none of them includes quoted text. And even with the broader support of treating words as white-space delimited (breaking from the English rule of usually not including punctuation), as you noted at least one of the examples there will fail (sorry, Mr. Van Damme). Many other languages also provide means of dealing with multi-character white space (sed, awk, and Python come to mind), and none of them, not even xTalk, will reliably sort by last name unless we separate the first and last more explicitly, such in separate fields or with a tab character, as is commonly done in any language where a last-name sort is important, even in LiveCode. In the second example in which a multi-word value is used as an object identifier, once again we're not asked to parse that using xTalk's word chunk type, but instead get to rely on the engine's expression evaluator, which works very much like JavaScript's and others' in which literal strings can be used as object identifiers. Useful as it is, it's neither unique to xTalk nor necessarily dependent on how we use the word chunk type. Object identifiers *can* become dependent on the word chunk type if you need to parse them yourself, as others have noted along with many other good examples to justify the HyperTalk team's implementation (though we might ask why we need to do this so often, such as why we don't have objectType or ownerStack functions). No matter how useful the current implementation is, the choice still requires justification. Even if that justification is sound, favoring a certain utility, it's still a trade-off, the downside being a redefinition of the word word from its more common definition in natural language. Larry's initial confusion is far from rare. xTalk's reliance on a unique definition of word that differs from its use in natural language is something we all had to learn. We may accept it, we may like it, we may even prefer it, but it's by no means intuitive to the native English speaker. xTalk was born more than a decade before Unicode was invented, so it couldn't have taken advantage of the vast pool of collective knowledge embodied in the Unicode spec, nor was there the luxury of having the computational horsepower needed to use such a spec efficiently. Today the LiveCode team has at last corrected this with the introduction of the trueWord token type, though I have to shrug my shoulders with an acknowledging chuckle in sharing Larry's initial observation that if xTalk were being designed today, with it's ostensible emphasis on English-like syntax, the order is backwards: If we didn't have 27 years of code dependent on xTalk's unique redefinition of word, to support the claim of English-like it might be more intuitive to have word act as trueWord does, and have some other token do what word currently does in xTalks unique redefinition. But that's not the world we live in. Like every other language, LiveCode is a product of its unique history. Useful as its conventions are, they will from time to time require us to learn new ways of doing things. This is just one of many reasons I generally don't use the phrase English-like when giving talks on LiveCode. Our favorite language brings to the world's programming choices a uniquely valuable blend of features, but while it's certainly more readable than most it isn't particularly English-like, nor does it really even try all that hard to be. And that's a good thing. Natural language is really tough stuff to parse, full of its own even longer and more nuanced history, and intended for a very different audience (the cognitive complexity of the human mind rather than the logical simplicity of computers). I think most of us (except Geoff Canyon who has a rare mind for this sort of stuff g) would agree that we're all glad this isn't a valid statement
Re: problem with counting words
I get that joke! Wait, maybe I didn’t, my email program does Unicode… On Oct 13, 2014, at 1:07 PM, la...@significantplanet.org wrote: Hi Richard, in a word... I really enjoyed reading your post and I learned a lot! ___ 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: problem with counting words
There's a qcc enhancement request out there for a new chunk type (chunk) along with a delimited by clause. For this example, it would be possible to put the number of chunks delimited by space of field xyz into tCount Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Mon, Oct 13, 2014 at 7:32 AM, Terence Heaford t.heaf...@btinternet.com wrote: set the wordDelim to space set the wordDelim to “*” set the wordDelim to “any single character you want” Should be easy for the LiveCode programmers to deliver such a command. also put the wordDelim into myVar Initally set to space, resets to space at the end of a handler. All the best Terry On 13 Oct 2014, at 15:23, Ralph DiMola rdim...@evergreeninfo.net wrote: -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Mark Wieder Sent: Sunday, October 12, 2014 8:00 PM To: How to use LiveCode Subject: Re: problem with counting words wordDelimiter would be an interesting addition, but would have its own complexities. You need to keep in mind that words are delimited by whitespace: spaces, tabs, carriage returns, etc., but also by some punctuation: commas, periods, semicolons, etc. I also find that text within quotes being a single word is congruent with defining arguments for comandline syntax. -- -Mark Wieder ahsoftw...@gmail.com Also don't forget the non-breaking space Decimal 160. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net ___ 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 ___ 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: problem with counting words
Colin's joke was cleverest but Larry your's was the funniest :) ...now if only I can come up with a reason why the buffalo crossed the road... Colin Holgate-2 wrote I get that joke! Wait, maybe I didn’t, my email program does Unicode… On Oct 13, 2014, at 1:07 PM, larry@ wrote: Hi Richard, in a word... I really enjoyed reading your post and I learned a lot! - Some are born coders, some achieve coding, and some have coding thrust upon them. - William Shakespeare Hugh Senior -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/problem-with-counting-words-tp4684441p4684506.html Sent from the Revolution - User mailing list archive at Nabble.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: problem with counting words
To get to the other’s hide? On Oct 13, 2014, at 3:01 PM, Dave Kilroy d...@applicationinsight.com wrote: ...now if only I can come up with a reason why the buffalo crossed the road... ___ 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: problem with counting words
Understandable. And yet the question is not how you are to interpret a word boundary, but how a computer which only knows ones and zeros can. It’s the (computer) age old problem: Computers don’t do what you want them to. They only do what you tell them to. ;-) A great example is how to discern a first, middle and last name in a full name field. Turns out it cannot be done with 100% reliability. Some names have spaces in them like Mac Donald or apostrophes like O’Connel or hyphens like Foster-Smith. Some people have more than three words in their full name. You would have to create a series of special case statements because when mankind invented last names, computers had not been invented yet. Bob S On Oct 12, 2014, at 13:04 , la...@significantplanet.orgmailto:la...@significantplanet.org wrote: Hi Terry, Here is the real problem. I don't know much. I'm sitting here assuming that a word is a word, regardless of whether it is inside quotes. ___ 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: problem with counting words
On 10/13/2014, 2:11 PM, Colin Holgate wrote: To get to the other’s hide? On Oct 13, 2014, at 3:01 PM, Dave Kilroy d...@applicationinsight.com wrote: ...now if only I can come up with a reason why the buffalo crossed the road... Ewww. That is either the best or worst thing I've seen today. -- 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: problem with counting words
Too funny :) Sean Cole *Pi Digital Productions Ltd* www.pidigital.co.uk +44(1634)402193 +44(7702)116447 π 'Don't try to think outside the box. Just remember the truth: There is no box!' 'For then you realise it is not the box you are trying to look outside of, but it is yourself!' This email and any files transmitted with it may be confidential and are intended solely for the use of the individual to whom it is addressed. You are hereby notified that if you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Any distribution, reproduction, modification or publication of this communication is strictly prohibited. If you have received this in error, please notify the sender and delete the message from your computer. Any opinions presented in this email are solely those of the author and do not necessarily represent those of Pi Digital. Pi Digital cannot accept any responsibility for the accuracy or completeness of this message and although this email and any attachments are believed to be free from viruses, it is the sole responsibility of the recipients. Pi Digital Productions Ltd is a UK registered limited company, no. 5255609. VAT GB998220972 On 13 October 2014 20:11, Colin Holgate co...@verizon.net wrote: To get to the other’s hide? On Oct 13, 2014, at 3:01 PM, Dave Kilroy d...@applicationinsight.com wrote: ...now if only I can come up with a reason why the buffalo crossed the road... ___ 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: problem with counting words
This is something I know about. Between a pretty decent VB com .dll and additional in house rules I get about 95.98% accuracy splitting up US/international name components. But there still is the .02% that need individual attention. I never process lists 100,000 so this error rate is acceptable. My system would have heart failure with a 3 part last name. Into the .02% bucket... Dr. Bob Brown Trustee for Ms. June Smith would not be split correctly. A reference to a relationship between two people is beyond my systems ability. The Mac Donald or apostrophes like O'Connel or hyphens like Foster-Smith are the easy cases even though one never knows what apostrophe variation will be used. When the last name is space delimited with nonstandard prefixes that it starts to get interesting. The only way to sort names with 100% accuracy is to have the name components from the get-go and use Unicode from start to finish. Maybe Watson can do it 100%, but I can't afford the CPU time. I can't wait until LC 7 gets settled down and I can use Unicode LC for production text processing. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Bob Sneidar Sent: Monday, October 13, 2014 4:20 PM To: How to use LiveCode Subject: Re: problem with counting words Understandable. And yet the question is not how you are to interpret a word boundary, but how a computer which only knows ones and zeros can. It's the (computer) age old problem: Computers don't do what you want them to. They only do what you tell them to. ;-) A great example is how to discern a first, middle and last name in a full name field. Turns out it cannot be done with 100% reliability. Some names have spaces in them like Mac Donald or apostrophes like O'Connel or hyphens like Foster-Smith. Some people have more than three words in their full name. You would have to create a series of special case statements because when mankind invented last names, computers had not been invented yet. Bob S On Oct 12, 2014, at 13:04 , la...@significantplanet.orgmailto:la...@significantplanet.org wrote: Hi Terry, Here is the real problem. I don't know much. I'm sitting here assuming that a word is a word, regardless of whether it is inside quotes. ___ 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: problem with counting words
Not particularly challenging but a cool name: Maximilian Maria Thurn and Taxis On 13.10.2014 at 18:54 Uhr -0400 Ralph DiMola apparently wrote: This is something I know about. Between a pretty decent VB com .dll and additional in house rules I get about 95.98% accuracy splitting up US/international name components. But there still is the .02% that need individual attention. I never process lists 100,000 so this error rate is acceptable. My system would have heart failure with a 3 part last name. Into the .02% bucket... Dr. Bob Brown Trustee for Ms. June Smith would not be split correctly. A reference to a relationship between two people is beyond my systems ability. The Mac Donald or apostrophes like O'Connel or hyphens like Foster-Smith are the easy cases even though one never knows what apostrophe variation will be used. When the last name is space delimited with nonstandard prefixes that it starts to get interesting. The only way to sort names with 100% accuracy is to have the name components from the get-go and use Unicode from start to finish. Maybe Watson can do it 100%, but I can't afford the CPU time. I can't wait until LC 7 gets settled down and I can use Unicode LC for production text processing. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net ___ 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: problem with counting words
Jacque- Monday, October 13, 2014, 2:35:12 PM, you wrote: Ewww. That is either the best or worst thing I've seen today. Or both. I can't decide. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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: problem with counting words
The dictionary clearly says that quoted strings are counted as a single word. If you wanted to work around that as an issue by using the itemDelimiter, you would then look at the number of items in the field, not the number of words. There’s a better option though, you can see how many truewords there are in the field, because that uses Unicode delimiters. If you don’t want to use truewords instead of words for some other reason, you could solve the issue by using smart quotes instead of dumb quotes. ___ 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: problem with counting words
Please tell me where it says that in the dictionary - I could find nothing about it. I also searched the User Guide for quoted strings and also smart quotes and found nothing. I also searched both the dictionary and the User Guide for truewords and found nothing. So I'm very mystified where this stuff is to be found and how it is to be found. I'm just trying to understand how this information is found so I don't need to keep bothering everyone on this list. Thanks, Larry - Original Message - From: Colin Holgate co...@verizon.net To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 12:36 PM Subject: Re: problem with counting words The dictionary clearly says that quoted strings are counted as a single word. If you wanted to work around that as an issue by using the itemDelimiter, you would then look at the number of items in the field, not the number of words. There’s a better option though, you can see how many truewords there are in the field, because that uses Unicode delimiters. If you don’t want to use truewords instead of words for some other reason, you could solve the issue by using smart quotes instead of dumb quotes. ___ 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: problem with counting words
Here are some of the relevant parts from the Dictionary entry for ‘word’: Summary: Designates a space-delimited or quoted string as part of a chunk expression. Comments: A word is delimited by one or more spaces, tabs, or returns, or enclosed by double quotes. A single word can contain multiple characters and multiple items, but not multiple lines. Note:Words are delimited by double quotes (), but not by curved quotes (). LiveCode does not treat curved quotes as quotes. Under the Dictionary entry for trueWord it says this: Summary: Designates a string as part of a chunk expression, delimited by Unicode word breaks, as determined by the ICU Library. There is an imperfection in the Dictionary entry for ‘words’, its comments includes this: Comments: A word is a set of characters enclosed by spaces, tabs, or returns. which doesn’t state anything about the double quotes. ___ 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: problem with counting words
Larry, From the word entry: Comments: A word is delimited by one or more spaces, tabs, or returns, or enclosed by double quotes. A single word can contain multiple characters and multiple items, but not multiple lines. Note: Words are delimited by double quotes (), but not by curved quotes (). LiveCode does not treat curved quotes as quotes. -- Best regards, Mark quote Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Installer Maker for LiveCode: http://qery.us/468 Buy my new book Programming LiveCode for the Real Beginner http://qery.us/3fi LiveCode on Facebook: https://www.facebook.com/groups/runrev/ On 10/12/2014 20:56, la...@significantplanet.org wrote: Please tell me where it says that in the dictionary - I could find nothing about it. I also searched the User Guide for quoted strings and also smart quotes and found nothing. I also searched both the dictionary and the User Guide for truewords and found nothing. So I'm very mystified where this stuff is to be found and how it is to be found. I'm just trying to understand how this information is found so I don't need to keep bothering everyone on this list. Thanks, Larry ___ 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: problem with counting words
Hi Larry, the itemDel is the character that delimits ITEMS, not words. You could use it to get around your problem with quotes. If you set the itemDel to space, you would then look for the number of ITEMS in the field. Thats not quite the end of it though, because there may not be a space between lines in the field, only returns. So, you could add up the number of items in each line - something like: put 0 into tCount set the itemDel to space repeat for each line L in field foo add the number of items in L to tCount end repeat (not tested) .Jerry On Oct 12, 2014, at 11:17 AM, la...@significantplanet.org wrote: Hello, I'm posting this to help any other poor saps who run into this insanity: I want to count the words in a field. I have: set the itemDel to space put the number of words of field myTest into field myNumber Here is what happens: I am testing the word count in LiveCode 6.1.1. Believe it or not, LiveCode will count all these words as 23 words because everything contained within the quotes is counted as ONE word!!! There is nothing that I could find that says LiveCode will treat everything within quotes as one word, even when I have itemDel set to space. I doubt the RunRev people will see this as a bug, but just how it is. Well, it's really stupid - and beyond that, it is not documented in the Dictionary that I could see. btw, I spoke to a programmer friend of mine (who used to work for Novell) and he said he'd never heard anything like that in the several programming languages he knows. Yes, I do know how to do a work around to count all the actual words, but that is not the point. The point is that I wasted over 2 hours of my time figuring out why my word count was inaccurate. quite depressed, Larry ___ 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: problem with counting words
Ah, and then there are tabs to deal with, and double-spaces will count an empty item between. It may be better to just replace the quotes with curly-quotes, count the words, and then replace the curly-quotes back to quotes if you want. On Oct 12, 2014, at 12:20 PM, Jerry Jensen j...@jhj.com wrote: Hi Larry, the itemDel is the character that delimits ITEMS, not words. You could use it to get around your problem with quotes. If you set the itemDel to space, you would then look for the number of ITEMS in the field. Thats not quite the end of it though, because there may not be a space between lines in the field, only returns. So, you could add up the number of items in each line - something like: put 0 into tCount set the itemDel to space repeat for each line L in field foo add the number of items in L to tCount end repeat (not tested) .Jerry On Oct 12, 2014, at 11:17 AM, la...@significantplanet.org wrote: Hello, I'm posting this to help any other poor saps who run into this insanity: I want to count the words in a field. I have: set the itemDel to space put the number of words of field myTest into field myNumber Here is what happens: I am testing the word count in LiveCode 6.1.1. Believe it or not, LiveCode will count all these words as 23 words because everything contained within the quotes is counted as ONE word!!! There is nothing that I could find that says LiveCode will treat everything within quotes as one word, even when I have itemDel set to space. I doubt the RunRev people will see this as a bug, but just how it is. Well, it's really stupid - and beyond that, it is not documented in the Dictionary that I could see. btw, I spoke to a programmer friend of mine (who used to work for Novell) and he said he'd never heard anything like that in the several programming languages he knows. Yes, I do know how to do a work around to count all the actual words, but that is not the point. The point is that I wasted over 2 hours of my time figuring out why my word count was inaccurate. quite depressed, Larry ___ 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 ___ 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: problem with counting words
On 10/12/2014, 1:56 PM, la...@significantplanet.org wrote: Please tell me where it says that in the dictionary - I could find nothing about it. Under the entry for word: Designates a space-delimited or quoted string as part of a chunk expression. Note: Words are delimited by double quotes (), but not by curved quotes (). LiveCode does not treat curved quotes as quotes. -- 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: problem with counting words
On 10/12/2014, 1:17 PM, la...@significantplanet.org wrote: btw, I spoke to a programmer friend of mine (who used to work for Novell) and he said he'd never heard anything like that in the several programming languages he knows. It's been in x-talk since HyperCard. BTW, the trueword token was introduced as part of the unicode implementation, so you'll only see it in LC version 7.0. When we all adopt that version, we will be able to choose between the logical word boundaries (trueword) and the historical boundaries (the HyperCard method, which also includes punctuation as part of words.) -- 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: problem with counting words
Wouldn’t it be good if RunRev could add WordDelimiter to the dictionary, would that solve the problem. I believe it exists in SuperCard. I thought LiveCode was a more modern version of SuperCard and would surely have this option. All the best Terry On 12 Oct 2014, at 20:20, Jerry Jensen j...@jhj.com wrote: the itemDel is the character that delimits ITEMS, not words. ___ 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: problem with counting words
Yes, but the current concept of delimiting words is not a single character. Space, tab, return all work. Now, if you could say: set the wordDel to space or tab or return That would be the ticket! Or you could extend it using that pesky unicode definition and call it trueword. H... On Oct 12, 2014, at 12:38 PM, Terence Heaford t.heaf...@btinternet.com wrote: Wouldn’t it be good if RunRev could add WordDelimiter to the dictionary, would that solve the problem. ___ 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: problem with counting words
Easy to say, but how does one replace the quotes with curly-quotes? I can't find out where it says how to do that. Sorry I'm so lame. Larry - Original Message - From: Jerry Jensen j...@jhj.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 1:26 PM Subject: Re: problem with counting words Ah, and then there are tabs to deal with, and double-spaces will count an empty item between. It may be better to just replace the quotes with curly-quotes, count the words, and then replace the curly-quotes back to quotes if you want. On Oct 12, 2014, at 12:20 PM, Jerry Jensen j...@jhj.com wrote: Hi Larry, the itemDel is the character that delimits ITEMS, not words. You could use it to get around your problem with quotes. If you set the itemDel to space, you would then look for the number of ITEMS in the field. Thats not quite the end of it though, because there may not be a space between lines in the field, only returns. So, you could add up the number of items in each line - something like: put 0 into tCount set the itemDel to space repeat for each line L in field foo add the number of items in L to tCount end repeat (not tested) .Jerry On Oct 12, 2014, at 11:17 AM, la...@significantplanet.org wrote: Hello, I'm posting this to help any other poor saps who run into this insanity: I want to count the words in a field. I have: set the itemDel to space put the number of words of field myTest into field myNumber Here is what happens: I am testing the word count in LiveCode 6.1.1. Believe it or not, LiveCode will count all these words as 23 words because everything contained within the quotes is counted as ONE word!!! There is nothing that I could find that says LiveCode will treat everything within quotes as one word, even when I have itemDel set to space. I doubt the RunRev people will see this as a bug, but just how it is. Well, it's really stupid - and beyond that, it is not documented in the Dictionary that I could see. btw, I spoke to a programmer friend of mine (who used to work for Novell) and he said he'd never heard anything like that in the several programming languages he knows. Yes, I do know how to do a work around to count all the actual words, but that is not the point. The point is that I wasted over 2 hours of my time figuring out why my word count was inaccurate. quite depressed, Larry ___ 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 ___ 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: problem with counting words
Hi Terry, Here is the real problem. I don't know much. I'm sitting here assuming that a word is a word, regardless of whether it is inside quotes. Now I find out there is trueword. It's just hard for me to reconcile LiveCode's boast of simple English and stuff like this. The other thing I don't understand is this: Is there any way to search the dictionary on the text of the dictionary and not just on the keywords? If there is a way to do that, I don't know how. It would help a lot. Thanks, Larry P.S. That would be a cool thing if they added a wordDel function. It would be REALLY cool if people could write their own functions and then add them to their personal LC dictionary. Probably there is a way to do that, but again, I don't know how. - Original Message - From: Terence Heaford t.heaf...@btinternet.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 1:38 PM Subject: Re: problem with counting words Wouldn’t it be good if RunRev could add WordDelimiter to the dictionary, would that solve the problem. I believe it exists in SuperCard. I thought LiveCode was a more modern version of SuperCard and would surely have this option. All the best Terry On 12 Oct 2014, at 20:20, Jerry Jensen j...@jhj.com wrote: the itemDel is the character that delimits ITEMS, not words. ___ 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: problem with counting words
Not lame. Good question! I've always tried to get RID of curly-quotes, never tried to use them. So, I pasted one in from Word and found out using charToNum that its number 210. replace quote with numToChar(210) in field foo --do your counting replace numToChar(210) with quote in field foo Actually, to skip all the confusion, you could just use a character for the replacement that isn't so obscure, like ~ or many others. Then you write: replace quote with ~ in field foo -- do your counting replace ~ with quote in field foo I have probably broken a bunch of the new unicode rules that I haven't learned about yet. .Jerry On Oct 12, 2014, at 12:58 PM, la...@significantplanet.org wrote: Easy to say, but how does one replace the quotes with curly-quotes? I can't find out where it says how to do that. Sorry I'm so lame. Larry ___ 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: problem with counting words
Larry. But you can make your own dictionary. Without limit. Most of that, too, has been possible since Hypercard. You can define your own properties, commands and functions, and place them in permanent use in several ways, for example, as a library stack in use or a plug-in. Have you ever written such a thing? Please write back if you have not, and we will play around for a while. Or if you have written such gadgetry, but just never saved any of them for later, general use in your own personal LC world, the tell us that as well. Craig Newman ___ 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: problem with counting words
Hi Craig, I've written several functions within stacks, but have no idea how to create a library stack or, seems better, as a plug-in. For example, one function I use in many of the programs I'm writing is: commaInsert: on commaInsert put round(thisFigure) into thisFigure if thisFigure 0 then put thisFigure * -1 into thisFigure put the length of thisFigure into L if L 3 then put , before char -3 of thisFigure put the length of thisFigure into L if L 7 then put , before char -7 of thisFigure put the length of thisFigure into L if L 11 then put , before char -11 of thisFigure put the length of thisFigure into L if L 15 then put , before char -15 of thisFigure -- THIS WOULD BE AT LEAST 1 TRILLION!! put $ before thisFigure end commaInsert I use the above function (command) after performing math functions on numbers that I then want to display as dollar amounts with the commas in the right places. It would be very cool to have it available all the time through a plug-in. It would be even more cool if I could somehow add it to the LC dictionary and do this: put commaInsert(thisFigure) into field myDollarDisplay if thisFigure 1 then set the textcolor of field myDollarDisplay to red Or even: put commaInsert(thisFigure + otherFigure) into [container] From what I've heard from programming friends, other languages allow for adding of functions to the dictionary as in the two line example in italics above. Do you know if that is possible in LC? As far as I know, it is not possible. Larry - Original Message - From: dunb...@aol.com To: use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 4:53 PM Subject: Re: problem with counting words Larry. But you can make your own dictionary. Without limit. Most of that, too, has been possible since Hypercard. You can define your own properties, commands and functions, and place them in permanent use in several ways, for example, as a library stack in use or a plug-in. Have you ever written such a thing? Please write back if you have not, and we will play around for a while. Or if you have written such gadgetry, but just never saved any of them for later, general use in your own personal LC world, the tell us that as well. Craig Newman ___ 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: problem with counting words
larry wrote: Here is the real problem. I don't know much. I'm sitting here assuming that a word is a word, regardless of whether it is inside quotes. Now I find out there is trueword. It's just hard for me to reconcile LiveCode's boast of simple English and stuff like this. I hear ya', but like so many other oddities in the language this one came from Apple, the same team who decided that we should be able to use property syntax for function calls, but only sometimes, and that many global properties should start with dont rather than change their default value, but again only sometimes. Those geographically inclined may note the proximity of the HyperCard team's workplace to the location where most of California's medical marijuana is grown today. Draw whatever conclusions you like from those two perhaps-unrelated facts -- Richard Gaskin Fourth World Systems Software Design and Development for Desktop, Mobile, and 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: problem with counting words
Terence- Sunday, October 12, 2014, 12:38:53 PM, you wrote: Wouldnt it be good if RunRev could add WordDelimiter to the dictionary, would that solve the problem. I believe it exists in SuperCard. I thought LiveCode was a more modern version of SuperCard and would surely have this option. wordDelimiter would be an interesting addition, but would have its own complexities. You need to keep in mind that words are delimited by whitespace: spaces, tabs, carriage returns, etc., but also by some punctuation: commas, periods, semicolons, etc. I also find that text within quotes being a single word is congruent with defining arguments for comandline syntax. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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: problem with counting words
Hello Mark, It truly pleases me that you explained a reason for text within quotes being a single word. I don't have enough experience (actually none) in defining arguments for commandline syntax and would never have thought of that. So now I must say, OK, there is a reason. However, I would still really like it if I could create my own functions as I please and add them directly into the LC dictionary/language of the IDE. I'm completely unclear how that would work with a plug-in. If I wrote functions and put them into an expandable plug-in (to add future functions) could I call those functions up within a script? For example: put larryFunction(larryVar) into field myLarry If anyone knows how to do that for the IDE so that the function I write is now available to me for ANY script of ANY stack, I would love to hear about it. Larry - Original Message - From: Mark Wieder mwie...@ahsoftware.net To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 6:00 PM Subject: Re: problem with counting words Terence- Sunday, October 12, 2014, 12:38:53 PM, you wrote: Wouldnt it be good if RunRev could add WordDelimiter to the dictionary, would that solve the problem. I believe it exists in SuperCard. I thought LiveCode was a more modern version of SuperCard and would surely have this option. wordDelimiter would be an interesting addition, but would have its own complexities. You need to keep in mind that words are delimited by whitespace: spaces, tabs, carriage returns, etc., but also by some punctuation: commas, periods, semicolons, etc. I also find that text within quotes being a single word is congruent with defining arguments for comandline syntax. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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: problem with counting words
larry- Sunday, October 12, 2014, 5:16:45 PM, you wrote: Hello Mark, It truly pleases me that you explained a reason for text within quotes being a single word. Glad I could help. I don't have enough experience (actually none) in defining arguments for commandline syntax and would never have thought of that. So now I must say, OK, there is a reason. It's pretty simple, really. If I have a program that counts lines in a file (let's call it linecount) and I want to call it with a file to work on, then from a command prompt I would say something like linecount fileToWorkOn.txt However, if someone made a file with a name that had embedded spaces, linecount some file with spaces.txt wouldn't work because the first thing that would happen is the linecount program would try to work on file some. What I'd need to do in that case is say linecount some file with spaces.txt And then the operating system would treat everything within the quotes as a single parameter. So I can extrapolate from that to xtalk languages treating everything within quotes as a single entity. If anyone knows how to do that for the IDE so that the function I write is now available to me for ANY script of ANY stack, I would love to hear about it. Well, my first advice would be to wait for the next major version of LiveCode, because the new initiative (I'm too tired and lazy at the moment to look up the name) is designed to give you exactly that capability. But if you want to play around with it now, you'll want to read up on frontscripts and backscripts. If you, for example, put a function into a script and then insert the script into the backscripts, the function will be available to any stack. This is a large part of how the IDE itself works. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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: problem with counting words
Mark, This is why personal functions are so important. You like having all the words within quotes being seen as a single word for commandline calls. On the other hand, it is giving me fits having to go from regular quotes to curly quotes (for counting) and then back to regular quotes for display (since LC displays a curly quote as some oddball char). But if I could write my own function for that stuff, wow. I do not have ANY experience with frontscripts, backscripts, plug-ins, whatever. Maybe some day. In the meantime, if anyone wants to write/point to a detailed explanation of how to do it, that will be great. I would say that an ability for me to write functions and have them available for scripting would be #1 on my wish list. Larry - Original Message - From: Mark Wieder mwie...@ahsoftware.net To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 6:32 PM Subject: Re: problem with counting words larry- Sunday, October 12, 2014, 5:16:45 PM, you wrote: Hello Mark, It truly pleases me that you explained a reason for text within quotes being a single word. Glad I could help. I don't have enough experience (actually none) in defining arguments for commandline syntax and would never have thought of that. So now I must say, OK, there is a reason. It's pretty simple, really. If I have a program that counts lines in a file (let's call it linecount) and I want to call it with a file to work on, then from a command prompt I would say something like linecount fileToWorkOn.txt However, if someone made a file with a name that had embedded spaces, linecount some file with spaces.txt wouldn't work because the first thing that would happen is the linecount program would try to work on file some. What I'd need to do in that case is say linecount some file with spaces.txt And then the operating system would treat everything within the quotes as a single parameter. So I can extrapolate from that to xtalk languages treating everything within quotes as a single entity. If anyone knows how to do that for the IDE so that the function I write is now available to me for ANY script of ANY stack, I would love to hear about it. Well, my first advice would be to wait for the next major version of LiveCode, because the new initiative (I'm too tired and lazy at the moment to look up the name) is designed to give you exactly that capability. But if you want to play around with it now, you'll want to read up on frontscripts and backscripts. If you, for example, put a function into a script and then insert the script into the backscripts, the function will be available to any stack. This is a large part of how the IDE itself works. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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: problem with counting words
Larry, Change the first line of your function to function commaInsert thisFigure Better yet: function commaInsert pFigure put pFigure into thisFigure Then add before the last end the following line return thisFigure If you have your function anywhere in the path (like in the stack script or library stack that is in use), then the following will work as you want put commaInsert(thisFigure) into field myDollarDisplay Robert On 12.10.2014 at 17:09 Uhr -0600 la...@significantplanet.org apparently wrote: Hi Craig, I've written several functions within stacks, but have no idea how to create a library stack or, seems better, as a plug-in. For example, one function I use in many of the programs I'm writing is: commaInsert: on commaInsert put round(thisFigure) into thisFigure if thisFigure 0 then put thisFigure * -1 into thisFigure put the length of thisFigure into L if L 3 then put , before char -3 of thisFigure put the length of thisFigure into L if L 7 then put , before char -7 of thisFigure put the length of thisFigure into L if L 11 then put , before char -11 of thisFigure put the length of thisFigure into L if L 15 then put , before char -15 of thisFigure -- THIS WOULD BE AT LEAST 1 TRILLION!! put $ before thisFigure end commaInsert I use the above function (command) after performing math functions on numbers that I then want to display as dollar amounts with the commas in the right places. It would be very cool to have it available all the time through a plug-in. It would be even more cool if I could somehow add it to the LC dictionary and do this: put commaInsert(thisFigure) into field myDollarDisplay if thisFigure 1 then set the textcolor of field myDollarDisplay to red Or even: put commaInsert(thisFigure + otherFigure) into [container] From what I've heard from programming friends, other languages allow for adding of functions to the dictionary as in the two line example in italics above. Do you know if that is possible in LC? As far as I know, it is not possible. Larry - Original Message - From: dunb...@aol.com To: use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 4:53 PM Subject: Re: problem with counting words Larry. But you can make your own dictionary. Without limit. Most of that, too, has been possible since Hypercard. You can define your own properties, commands and functions, and place them in permanent use in several ways, for example, as a library stack in use or a plug-in. Have you ever written such a thing? Please write back if you have not, and we will play around for a while. Or if you have written such gadgetry, but just never saved any of them for later, general use in your own personal LC world, the tell us that as well. Craig Newman ___ 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 ___ 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: problem with counting words
Hi Robert, I understand what you wrote. That is not a problem for me. What I want is to be able to put my function into the LC IDE so that I can use it in other stacks. You mention a library stack. I do not know how to make one or use one. Is there some tutorial or something that will tell me how? Thanks, Larry - Original Message - From: Robert Brenstein r...@robelko.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 7:15 PM Subject: Re: problem with counting words Larry, Change the first line of your function to function commaInsert thisFigure Better yet: function commaInsert pFigure put pFigure into thisFigure Then add before the last end the following line return thisFigure If you have your function anywhere in the path (like in the stack script or library stack that is in use), then the following will work as you want put commaInsert(thisFigure) into field myDollarDisplay Robert On 12.10.2014 at 17:09 Uhr -0600 la...@significantplanet.org apparently wrote: Hi Craig, I've written several functions within stacks, but have no idea how to create a library stack or, seems better, as a plug-in. For example, one function I use in many of the programs I'm writing is: commaInsert: on commaInsert put round(thisFigure) into thisFigure if thisFigure 0 then put thisFigure * -1 into thisFigure put the length of thisFigure into L if L 3 then put , before char -3 of thisFigure put the length of thisFigure into L if L 7 then put , before char -7 of thisFigure put the length of thisFigure into L if L 11 then put , before char -11 of thisFigure put the length of thisFigure into L if L 15 then put , before char -15 of thisFigure -- THIS WOULD BE AT LEAST 1 TRILLION!! put $ before thisFigure end commaInsert I use the above function (command) after performing math functions on numbers that I then want to display as dollar amounts with the commas in the right places. It would be very cool to have it available all the time through a plug-in. It would be even more cool if I could somehow add it to the LC dictionary and do this: put commaInsert(thisFigure) into field myDollarDisplay if thisFigure 1 then set the textcolor of field myDollarDisplay to red Or even: put commaInsert(thisFigure + otherFigure) into [container] From what I've heard from programming friends, other languages allow for adding of functions to the dictionary as in the two line example in italics above. Do you know if that is possible in LC? As far as I know, it is not possible. Larry - Original Message - From: dunb...@aol.com To: use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 4:53 PM Subject: Re: problem with counting words Larry. But you can make your own dictionary. Without limit. Most of that, too, has been possible since Hypercard. You can define your own properties, commands and functions, and place them in permanent use in several ways, for example, as a library stack in use or a plug-in. Have you ever written such a thing? Please write back if you have not, and we will play around for a while. Or if you have written such gadgetry, but just never saved any of them for later, general use in your own personal LC world, the tell us that as well. Craig Newman ___ 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 ___ 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: problem with counting words
On Mon, Oct 13, 2014 at 7:45 AM, Richard Gaskin ambassa...@fourthworld.com wrote: I hear ya', but like so many other oddities in the language this one came from Apple, Sheer brilliance! One of the first analogies of HyperCard was that it was a an electronic rolodex. Here is a list of names: Abu MusabAl-Zarqawi Camilla Parker-Bowles CatherineZeta-Jones Claude Levi-Strauss D'ArcyCorrigan Daniel Day-Lewis DavidBen-Gurion Dodi Al-Fayed FlorenceGriffith-Joyner Gilbert O'Sullivan GloriaMacapagal-Arroyo Jean-Claude Van Damme JimmyO'Dea Justine Henin-Hardenne KareemAbdul-Jabbar Karim Abdul-Jabbar KristinScott-Thomas Maddox Jolie-Pitt MichaelO'Leary Olivia Newton-John PeterO'Toole Sinéad O'Connor TimBrooke-Taylor Ralph Twistleton-Wykham-Fiennes So lets say you want to sort these by surname - a kind of rolodex thing to do. sort lines of myListOfNames by word of -1 each will result in only one mistake sort lines of myListOfnames by trueword -1 of each --if you are on LC7.0 will result in basically the same messed up result most other programming languages will give you. Put it in and word processor and see how you go. Please feel free to try and write your own function that is more successful and more efficient than the beautiful one liner Bill Atkinson gave us. Even if you had wordDel it wouldn't help much. I can't imagine the amount of hours that have been wasted, especially on genealogical websites, trying to unfathom why double barrelled names never sort correctly. This is also compounded by the certain fact that some people will put a space between the last given name and the Surname, some a tab, and some will 'format' the data by placing multiple spaces in between names so that things 'line up nicely' - and are then confused as to why it only looks that way on their screen an not on someone else's. One of the reasons double barrelled names have picked up the '-' is to help computers recognise them as a single word. Also; put myVariable into fld Not A Variable doesn't work put myVariable into fld Not A Variable does. The ability to recognise words in quote as a single entity is extremely important. Yes, we don't typically think of such as a single word, but when we understand that computers don't think like us, and we do understand why things are the way they are, such oddities can be manipulated in many powerful ways to our own advantage. It is also helpful when we understand such things that we don't go around replacing one character willy nilly with another character. ~ [tilde] for instance is one character I'd never use as it has a special meaning in many computer languages; as does / \ . * and many others. If we had some text that contained both straight and curly quotes and replaced the straight quotes with curly quotes so we could get a word count, and then changed the curly quotes back to straight quotes, the finL text is not the same as it started - and this could cause problems. Today your function might work perfectly for today's problem, but next month, or next year, when you start expanding your LC skills and try working with SQL databases, or Servers and network connections, every now and then someone will report a bug that your app does something strange. You may never be able to track it down because it just happens that once every million DB calls a random user happens to use data that contains a character that you never use yourself and thought no one else would. I have a particular liking to numToChar(127) myself. Yep, no other programming language might define a word like LC defines a word, but I for one am EXTREMELY thankful for that. ___ 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: problem with counting words
On Mon, Oct 13, 2014 at 9:58 AM, Kay C Lan lan.kc.macm...@gmail.com wrote: sort lines of myListOfNames by word of -1 each sort lnes of myListOfNames by word -1 of each Hate it when I hit send and then immediately see an error in my typing. ___ 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: problem with counting words
Open the User Guide (from the IDE Help Menu select 'User Guide' and type Library in your pdf viewer's search box. Chapter 5.8 'Extending the Message Path' should come up as the first hit. This also may be helpful: http://lessons.runrev.com/m/4071/l/11787-how-to-call-a-function-or-command-in-another-object HTH On Mon, Oct 13, 2014 at 9:58 AM, la...@significantplanet.org wrote: Hi Robert, I understand what you wrote. That is not a problem for me. What I want is to be able to put my function into the LC IDE so that I can use it in other stacks. You mention a library stack. I do not know how to make one or use one. Is there some tutorial or something that will tell me how? Thanks, Larry - Original Message - From: Robert Brenstein r...@robelko.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 7:15 PM Subject: Re: problem with counting words Larry, Change the first line of your function to function commaInsert thisFigure Better yet: function commaInsert pFigure put pFigure into thisFigure Then add before the last end the following line return thisFigure If you have your function anywhere in the path (like in the stack script or library stack that is in use), then the following will work as you want put commaInsert(thisFigure) into field myDollarDisplay Robert On 12.10.2014 at 17:09 Uhr -0600 la...@significantplanet.org apparently wrote: Hi Craig, I've written several functions within stacks, but have no idea how to create a library stack or, seems better, as a plug-in. For example, one function I use in many of the programs I'm writing is: commaInsert: on commaInsert put round(thisFigure) into thisFigure if thisFigure 0 then put thisFigure * -1 into thisFigure put the length of thisFigure into L if L 3 then put , before char -3 of thisFigure put the length of thisFigure into L if L 7 then put , before char -7 of thisFigure put the length of thisFigure into L if L 11 then put , before char -11 of thisFigure put the length of thisFigure into L if L 15 then put , before char -15 of thisFigure -- THIS WOULD BE AT LEAST 1 TRILLION!! put $ before thisFigure end commaInsert I use the above function (command) after performing math functions on numbers that I then want to display as dollar amounts with the commas in the right places. It would be very cool to have it available all the time through a plug-in. It would be even more cool if I could somehow add it to the LC dictionary and do this: put commaInsert(thisFigure) into field myDollarDisplay if thisFigure 1 then set the textcolor of field myDollarDisplay to red Or even: put commaInsert(thisFigure + otherFigure) into [container] From what I've heard from programming friends, other languages allow for adding of functions to the dictionary as in the two line example in italics above. Do you know if that is possible in LC? As far as I know, it is not possible. Larry - Original Message - From: dunb...@aol.com To: use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 4:53 PM Subject: Re: problem with counting words Larry. But you can make your own dictionary. Without limit. Most of that, too, has been possible since Hypercard. You can define your own properties, commands and functions, and place them in permanent use in several ways, for example, as a library stack in use or a plug-in. Have you ever written such a thing? Please write back if you have not, and we will play around for a while. Or if you have written such gadgetry, but just never saved any of them for later, general use in your own personal LC world, the tell us that as well. Craig Newman ___ 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 ___ 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 ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http
Re: problem with counting words
Hello Kay, Mark gave me a short explanation of why it is good to see the words within quotes as one word and now you've given a longer and more detailed explanation. So I thank you and I will stop throwing rocks at my computer. Larry P.S. I still want to understand how to write my own functions that I can use right within any script of any stack. - Original Message - From: Kay C Lan lan.kc.macm...@gmail.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 7:58 PM Subject: Re: problem with counting words On Mon, Oct 13, 2014 at 7:45 AM, Richard Gaskin ambassa...@fourthworld.com wrote: I hear ya', but like so many other oddities in the language this one came from Apple, Sheer brilliance! One of the first analogies of HyperCard was that it was a an electronic rolodex. Here is a list of names: Abu MusabAl-Zarqawi Camilla Parker-Bowles CatherineZeta-Jones Claude Levi-Strauss D'ArcyCorrigan Daniel Day-Lewis DavidBen-Gurion Dodi Al-Fayed FlorenceGriffith-Joyner Gilbert O'Sullivan GloriaMacapagal-Arroyo Jean-Claude Van Damme JimmyO'Dea Justine Henin-Hardenne KareemAbdul-Jabbar Karim Abdul-Jabbar KristinScott-Thomas Maddox Jolie-Pitt MichaelO'Leary Olivia Newton-John PeterO'Toole Sinéad O'Connor TimBrooke-Taylor Ralph Twistleton-Wykham-Fiennes So lets say you want to sort these by surname - a kind of rolodex thing to do. sort lines of myListOfNames by word of -1 each will result in only one mistake sort lines of myListOfnames by trueword -1 of each --if you are on LC7.0 will result in basically the same messed up result most other programming languages will give you. Put it in and word processor and see how you go. Please feel free to try and write your own function that is more successful and more efficient than the beautiful one liner Bill Atkinson gave us. Even if you had wordDel it wouldn't help much. I can't imagine the amount of hours that have been wasted, especially on genealogical websites, trying to unfathom why double barrelled names never sort correctly. This is also compounded by the certain fact that some people will put a space between the last given name and the Surname, some a tab, and some will 'format' the data by placing multiple spaces in between names so that things 'line up nicely' - and are then confused as to why it only looks that way on their screen an not on someone else's. One of the reasons double barrelled names have picked up the '-' is to help computers recognise them as a single word. Also; put myVariable into fld Not A Variable doesn't work put myVariable into fld Not A Variable does. The ability to recognise words in quote as a single entity is extremely important. Yes, we don't typically think of such as a single word, but when we understand that computers don't think like us, and we do understand why things are the way they are, such oddities can be manipulated in many powerful ways to our own advantage. It is also helpful when we understand such things that we don't go around replacing one character willy nilly with another character. ~ [tilde] for instance is one character I'd never use as it has a special meaning in many computer languages; as does / \ . * and many others. If we had some text that contained both straight and curly quotes and replaced the straight quotes with curly quotes so we could get a word count, and then changed the curly quotes back to straight quotes, the finL text is not the same as it started - and this could cause problems. Today your function might work perfectly for today's problem, but next month, or next year, when you start expanding your LC skills and try working with SQL databases, or Servers and network connections, every now and then someone will report a bug that your app does something strange. You may never be able to track it down because it just happens that once every million DB calls a random user happens to use data that contains a character that you never use yourself and thought no one else would. I have a particular liking to numToChar(127) myself. Yep, no other programming language might define a word like LC defines a word, but I for one am EXTREMELY thankful for that. ___ 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: problem with counting words
On 12.10.2014 at 19:58 Uhr -0600 la...@significantplanet.org apparently wrote: Hi Robert, I understand what you wrote. That is not a problem for me. What I want is to be able to put my function into the LC IDE so that I can use it in other stacks. You mention a library stack. I do not know how to make one or use one. Is there some tutorial or something that will tell me how? Thanks, Larry Well, you showed a code for command but talked about using it as a function, hence my email. A library stack is a stack with your library functions in its stack script and which is activated as a library by issuing the start using command (either manually or through a script). You can place that stack in the plugins folder and set up the plugin manager to activate it automatically when launching IDE. All this is in documentation. Start with start using command, me thinks. Robert ___ 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: problem with counting words
On 10/12/2014, 7:32 PM, Mark Wieder wrote: What I'd need to do in that case is say linecount some file with spaces.txt And then the operating system would treat everything within the quotes as a single parameter. Which is probably the same reason the HC team did it that way, because the example they used to give involved the ease of extracting object names. The name of an object is in the form: stack My Great Stack button Click Me And if you wanted the short name you just got word 2 of the name. That would be a single parameter that was easy to pass to the engine. -- 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: problem with counting words
Hello Kay, I read the chapter in the user guide about creating a library. I also read insert script in the dictionary and it talks about a limit of 10 scripts(10 front and 10 back) in the compiled app. What I'm unclear about is, may I have multiple functions within, say, a card or stack script? In other words, if I have one script that contains 10 commands within it that could be called up, is that counted as 1 script or as 10 scripts? Thanks, Larry - Original Message - From: Kay C Lan lan.kc.macm...@gmail.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 8:09 PM Subject: Re: problem with counting words Open the User Guide (from the IDE Help Menu select 'User Guide' and type Library in your pdf viewer's search box. Chapter 5.8 'Extending the Message Path' should come up as the first hit. This also may be helpful: http://lessons.runrev.com/m/4071/l/11787-how-to-call-a-function-or-command-in-another-object HTH On Mon, Oct 13, 2014 at 9:58 AM, la...@significantplanet.org wrote: Hi Robert, I understand what you wrote. That is not a problem for me. What I want is to be able to put my function into the LC IDE so that I can use it in other stacks. You mention a library stack. I do not know how to make one or use one. Is there some tutorial or something that will tell me how? Thanks, Larry - Original Message - From: Robert Brenstein r...@robelko.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 7:15 PM Subject: Re: problem with counting words Larry, Change the first line of your function to function commaInsert thisFigure Better yet: function commaInsert pFigure put pFigure into thisFigure Then add before the last end the following line return thisFigure If you have your function anywhere in the path (like in the stack script or library stack that is in use), then the following will work as you want put commaInsert(thisFigure) into field myDollarDisplay Robert On 12.10.2014 at 17:09 Uhr -0600 la...@significantplanet.org apparently wrote: Hi Craig, I've written several functions within stacks, but have no idea how to create a library stack or, seems better, as a plug-in. For example, one function I use in many of the programs I'm writing is: commaInsert: on commaInsert put round(thisFigure) into thisFigure if thisFigure 0 then put thisFigure * -1 into thisFigure put the length of thisFigure into L if L 3 then put , before char -3 of thisFigure put the length of thisFigure into L if L 7 then put , before char -7 of thisFigure put the length of thisFigure into L if L 11 then put , before char -11 of thisFigure put the length of thisFigure into L if L 15 then put , before char -15 of thisFigure -- THIS WOULD BE AT LEAST 1 TRILLION!! put $ before thisFigure end commaInsert I use the above function (command) after performing math functions on numbers that I then want to display as dollar amounts with the commas in the right places. It would be very cool to have it available all the time through a plug-in. It would be even more cool if I could somehow add it to the LC dictionary and do this: put commaInsert(thisFigure) into field myDollarDisplay if thisFigure 1 then set the textcolor of field myDollarDisplay to red Or even: put commaInsert(thisFigure + otherFigure) into [container] From what I've heard from programming friends, other languages allow for adding of functions to the dictionary as in the two line example in italics above. Do you know if that is possible in LC? As far as I know, it is not possible. Larry - Original Message - From: dunb...@aol.com To: use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 4:53 PM Subject: Re: problem with counting words Larry. But you can make your own dictionary. Without limit. Most of that, too, has been possible since Hypercard. You can define your own properties, commands and functions, and place them in permanent use in several ways, for example, as a library stack in use or a plug-in. Have you ever written such a thing? Please write back if you have not, and we will play around for a while. Or if you have written such gadgetry, but just never saved any of them for later, general use in your own personal LC world, the tell us that as well. Craig Newman ___ 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 ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit
Re: problem with counting words
On 10/12/2014, 7:42 PM, la...@significantplanet.org wrote: On the other hand, it is giving me fits having to go from regular quotes to curly quotes (for counting) and then back to regular quotes for display (since LC displays a curly quote as some oddball char). But if I could write my own function for that stuff, wow. I think I'd just make a copy of the text in a variable, delete all the quotes, and count the words. After you get the count, discard the variable. You don't need to reconstruct it. I do not have ANY experience with frontscripts, backscripts, plug-ins, whatever. You can do what you want once you learn about that stuff. Many of us have custom libraries, frontscripts, and backscripts that help us work. You could start here: http://www.fourthworld.com/embassy/articles/revolution_message_path.html A backscript is just a script you write that you can put into the message path; it receives messages after everything else gets a shot at them. The script can live in any object; buttons are common storage places. That's probably what you're looking for. A frontscript is the same as a backscript only it gets messages before anything else; I'd avoid those until you understand the message path pretty well. See the link above. A library behaves like a backscript, only the script has to be in the script of another stack; the stack is opened and put in use. The difference between a library and a backscript is minimal, except libraries get a message when they're first opened so they can respond if necessary. There used to be a slight difference in the layering order too, but I'm not sure whether that's still valid. Practically speaking, it's unimportant. A plugin isn't what you want; it's just a stack that carries out some specific actions, and the IDE makes it available in the menu for convenience. -- 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: problem with counting words
HI Larry, That information is out of date, there are no more script limits, these were removed when LC went Community - yippeee ;-) You can test this by, in the message box: put the scriptLimits it should return, 0,0,0,0 so you are free to make your script library as huge as you want and your commands and functions can be as big as needed. On Mon, Oct 13, 2014 at 10:29 AM, la...@significantplanet.org wrote: Hello Kay, I read the chapter in the user guide about creating a library. I also read insert script in the dictionary and it talks about a limit of 10 scripts(10 front and 10 back) in the compiled app. What I'm unclear about is, may I have multiple functions within, say, a card or stack script? In other words, if I have one script that contains 10 commands within it that could be called up, is that counted as 1 script or as 10 scripts? Thanks, Larry - Original Message - From: Kay C Lan lan.kc.macm...@gmail.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 8:09 PM Subject: Re: problem with counting words Open the User Guide (from the IDE Help Menu select 'User Guide' and type Library in your pdf viewer's search box. Chapter 5.8 'Extending the Message Path' should come up as the first hit. This also may be helpful: http://lessons.runrev.com/m/4071/l/11787-how-to-call-a- function-or-command-in-another-object HTH On Mon, Oct 13, 2014 at 9:58 AM, la...@significantplanet.org wrote: Hi Robert, I understand what you wrote. That is not a problem for me. What I want is to be able to put my function into the LC IDE so that I can use it in other stacks. You mention a library stack. I do not know how to make one or use one. Is there some tutorial or something that will tell me how? Thanks, Larry - Original Message - From: Robert Brenstein r...@robelko.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 7:15 PM Subject: Re: problem with counting words Larry, Change the first line of your function to function commaInsert thisFigure Better yet: function commaInsert pFigure put pFigure into thisFigure Then add before the last end the following line return thisFigure If you have your function anywhere in the path (like in the stack script or library stack that is in use), then the following will work as you want put commaInsert(thisFigure) into field myDollarDisplay Robert On 12.10.2014 at 17:09 Uhr -0600 la...@significantplanet.org apparently wrote: Hi Craig, I've written several functions within stacks, but have no idea how to create a library stack or, seems better, as a plug-in. For example, one function I use in many of the programs I'm writing is: commaInsert: on commaInsert put round(thisFigure) into thisFigure if thisFigure 0 then put thisFigure * -1 into thisFigure put the length of thisFigure into L if L 3 then put , before char -3 of thisFigure put the length of thisFigure into L if L 7 then put , before char -7 of thisFigure put the length of thisFigure into L if L 11 then put , before char -11 of thisFigure put the length of thisFigure into L if L 15 then put , before char -15 of thisFigure -- THIS WOULD BE AT LEAST 1 TRILLION!! put $ before thisFigure end commaInsert I use the above function (command) after performing math functions on numbers that I then want to display as dollar amounts with the commas in the right places. It would be very cool to have it available all the time through a plug-in. It would be even more cool if I could somehow add it to the LC dictionary and do this: put commaInsert(thisFigure) into field myDollarDisplay if thisFigure 1 then set the textcolor of field myDollarDisplay to red Or even: put commaInsert(thisFigure + otherFigure) into [container] From what I've heard from programming friends, other languages allow for adding of functions to the dictionary as in the two line example in italics above. Do you know if that is possible in LC? As far as I know, it is not possible. Larry - Original Message - From: dunb...@aol.com To: use-livecode@lists.runrev.com Sent: Sunday, October 12, 2014 4:53 PM Subject: Re: problem with counting words Larry. But you can make your own dictionary. Without limit. Most of that, too, has been possible since Hypercard. You can define your own properties, commands and functions, and place them in permanent use in several ways, for example, as a library stack in use or a plug-in. Have you ever written such a thing? Please write back if you have not, and we will play around for a while. Or if you have written such gadgetry, but just never saved any of them for later, general use in your own personal LC world, the tell us that as well. Craig Newman ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit
Re: problem with counting words
On Oct 12, 2014, at 10:51 PM, J. Landman Gay wrote: A backscript is just a script you write that you can put into the message path; it receives messages after everything else gets a shot at them. The script can live in any object; buttons are common storage places. That's probably what you're looking for. A frontscript is the same as a backscript only it gets messages before anything else; I'd avoid those until you understand the message path pretty well. See the link above. A library behaves like a backscript, only the script has to be in the script of another stack; the stack is opened and put in use. The difference between a library and a backscript is minimal, except libraries get a message when they're first opened so they can respond if necessary. There used to be a slight difference in the layering order too, but I'm not sure whether that's still valid. Practically speaking, it's unimportant. A plugin isn't what you want; it's just a stack that carries out some specific actions, and the IDE makes it available in the menu for convenience. You can create a plugin that opens invisibly when you start up LiveCode, and the plugin can contain a button with a script full of whatever functions and commands you want to have available. Then you can put this into the plugin stack script: on openstack insert script of btn myLibrary into back end openstack And that will make all the handlers in the button script library available to you everywhere you work in LiveCode, automatically, since the library script will be activated whenever you start LC. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ 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: problem with counting words
On 10/12/2014, 10:04 PM, Peter M. Brigham wrote: You can create a plugin that opens invisibly when you start up LiveCode, and the plugin can contain a button with a script full of whatever functions and commands you want to have available. Then you can put this into the plugin stack script: on openstack insert script of btn myLibrary into back end openstack And that will make all the handlers in the button script library available to you everywhere you work in LiveCode, automatically, since the library script will be activated whenever you start LC. That's how I do it too, but I didn't want to get too deep into things yet. One thing to mention though is that these custom solutions won't transfer to stacks that are distributed to others unless the backscript is included as part of the distribution. I know a little about what Larry's working on, so in this case he'd be better off with a backscript. For only private use during development though, the plugin method is awfully handy. -- 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: problem with counting words
On 10/12/2014, 9:29 PM, la...@significantplanet.org wrote: What I'm unclear about is, may I have multiple functions within, say, a card or stack script? In other words, if I have one script that contains 10 commands within it that could be called up, is that counted as 1 script or as 10 scripts? One script. My current project has a single backscript with maybe a hundred functions and commands in it. It's one script. -- 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: problem with counting words
larry- Sunday, October 12, 2014, 7:10:26 PM, you wrote: So I thank you and I will stop throwing rocks at my computer. LOL. Don't stop throwing rocks - it's an essential part of programming. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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: problem with counting words
larry- Sunday, October 12, 2014, 6:58:21 PM, you wrote: You mention a library stack. I do not know how to make one or use one. Is there some tutorial or something that will tell me how? Well, *do* followup on reading Richard Gaskin's writeup on the message path. But meanwhile try this... put the following into a button's script (here the button is named myFunctions): on commaInsert --your code here-- end commaInsert then from the messagebox type insert the script of button myFunctions into back now the commaInsert command is available to all stacks. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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: problem with counting words
On 10/12/2014, 10:23 PM, Mark Wieder wrote: larry- Sunday, October 12, 2014, 7:10:26 PM, you wrote: So I thank you and I will stop throwing rocks at my computer. LOL. Don't stop throwing rocks - it's an essential part of programming. Absolutely. I keep a pile of rocks next to my desk. By the end of winter I've usually run out, and there is too much snow to go get more, so then I start throwing my husband. He has opinions about that. -- 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: problem with counting words
On Mon, Oct 13, 2014 at 11:16 AM, J. Landman Gay jac...@hyperactivesw.com wrote: One thing to mention though is that these custom solutions won't transfer to stacks that are distributed to others The other thing to remember is a plugin can't be edited as easily as any other stack. If Larry is just starting out making a 'collection' of useful commands and functions, he will probably be better off locating it in a simple button so he can easily get to it, add to it, amend it and transfer it as needed. Once it's content has settled down, and he's more familiar with LC, IDE, stacks, standalones and there idiosyncrasies, then he can have a look moving it to a plugin. ___ 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: problem with counting words
On 10/12/2014, 10:42 PM, Jerry Jensen wrote: Jacque has a lovely talent for seeing simple solutions. I have an unfortunate obsession with saving bytes from ye olden days. Thank you, but I'm afraid any talent I have is due to total oblivion about such things. I'm a one-trick language pony, I don't know any better. My motto is: Bytes be damned, let the engine handle it. If it can't, I figure it's a bug. -- 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: problem with counting words
On Oct 12, 2014, at 9:03 PM, J. Landman Gay jac...@hyperactivesw.com wrote: On 10/12/2014, 10:42 PM, Jerry Jensen wrote: Jacque has a lovely talent for seeing simple solutions. I have an unfortunate obsession with saving bytes from ye olden days. Thank you, but I'm afraid any talent I have is due to total oblivion about such things. I'm a one-trick language pony, I don't know any better. My motto is: Bytes be damned, let the engine handle it. If it can't, I figure it's a bug. I say right out loud that is totally appropriate for this millenium. .Jerry ___ 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: problem with counting words
On Mon, Oct 13, 2014 at 12:10 PM, Jerry Jensen j...@jhj.com wrote: On Oct 12, 2014, at 9:03 PM, J. Landman Gay jac...@hyperactivesw.com wrote: My motto is: Bytes be damned, let the engine handle it. I say right out loud that is totally appropriate for this millenium. .Jerry Yes, thankfully Bytes don't take up as much space anymore: https://plus.google.com/u/0/+ChrisBetcher/posts/EfFxSLzR9wN?cfem=1 ___ 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: problem with counting words
Here's a function to count the words disregarding quotes. Note that it's important to replace quotes with space, because there are three words in this isthree words and there are three words in this isthree words but you want to count four words, which this will do: function wordsWithoutQuotes S replace quote with space in S return the number of words in S end wordsWithoutQuotes ___ 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: problem with counting words
Hi. You have plenty to think about. But maybe something more concrete will get you started. You are certainly game. Make two new stacks. They will be named untitled 1 and untitled 2. No matter. In stack untitled 1 place a button. In its script put: on mouseUp start using stack untitled 2 addTen 15 end mouseUp In the script of stack untitled 2 place this in the stack script: on addTen var answer var + 10 end addTen Whenever you place that library stack in use, which can be done at the beginning of each session if you want (could be a plug-in) you will have the ability to add 10 to any number from absolutely anywhere in LC. Now this will break if you send a parameter that is not a number, so it needs beefing up. But the point is that you now have a library stack. Save it. Keep it. You can add as much stuff to it as you wish, including functions. the trick is to get the way it works. Craig ___ 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: problem with counting words
Jacque- Sunday, October 12, 2014, 8:43:34 PM, you wrote: Absolutely. I keep a pile of rocks next to my desk. By the end of winter I've usually run out, and there is too much snow to go get more, so then I start throwing my husband. He has opinions about that. When I started out, all we had were rocks. And we were happy to get them. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ 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