Search found 82 matches

by rkriesel
Thu Aug 13, 2020 6:18 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Equivalent of classes in LiveCode
Replies: 66
Views: 2868

Re: Equivalent of classes in LiveCode

Hi, Bernd. Thanks for the stack. I'm still considering it.

Meanwhile, how about, by convention, passing the object id to every constructor and destructor, instead of relying on "me" to identify the object?

-- Dick
by rkriesel
Wed Aug 12, 2020 3:04 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Equivalent of classes in LiveCode
Replies: 66
Views: 2868

Re: Equivalent of classes in LiveCode

before birth pX, pY, pdX, pdY, pLifeSpan, pParticleSource, pGravity --dispatch "birth" to the behavior of me with px, py, pdX, pdY, pLifeSpan, pParticleSource -- blocked BN if pGravity is empty then set the gravity of me to 1 else set the gravity of me to pGravity end if end birth before animate se...
by rkriesel
Sat Aug 08, 2020 12:16 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Something is not right with my data
Replies: 45
Views: 1633

Re: [SOLVED] Something is not right with my data

put the monthNames into tMonthsArray replace CR with (TAB & CR) in tMonthsArray split tMonthsArray by CR and TAB repeat for each item aMonth in field "Month Data" add 1 to tMonthsArray[ aMonth] end repeat combine tMonthsArray using CR and TAB put tMonthsArray into field "Monthly Counts" Hi, Thierry...
by rkriesel
Wed Aug 05, 2020 7:06 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Something is not right with my data
Replies: 45
Views: 1633

Re: [SOLVED] Something is not right with my data

get it & line i of the monthNames, tCounts[ i ] & cr @dick, should the "it" in that line be an "i"? Hi, Jacque. "it" works here, containing all the lines "it" contained before the statement, and the statement appends another line. The syntax is a compact equivalent of "put <line> & cr after <lines>...
by rkriesel
Wed Aug 05, 2020 6:42 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Something is not right with my data
Replies: 45
Views: 1633

Re: Something is not right with Livecode Strings

In a moment of clarity, I wrote the following code in a new project with nothing loaded: ... It works 100%. ... Hi, karmacomposer. Now that your code works, you might like to simplify it, as a way to learn simpler techniques, and accelerate future coding. Here's a suggestion: function testMonthsAnd...
by rkriesel
Mon Jul 27, 2020 11:16 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: looping through an array of JSON objects
Replies: 4
Views: 306

Re: looping through an array of JSON objects

... on mouseUp put field 1 into tData put JSONToArray(tData) into tArray repeat for each key aKey in tArray if tArray[aKey]["name"] = "max" then put "Max" & cr & tArray[aKey]["number"] into field 2 exit repeat -- just bail out because you have found what you were looking for end repeat end mouseUp ...
by rkriesel
Tue Jul 21, 2020 12:44 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Filtering an array...
Replies: 11
Views: 714

Re: Filtering an array...

... repeat for each key tKey in tArray if tArray[tKey]["abc"] = "xyz" then put tArray[tKey] into tSelected[tKey] end repeat ... results in tSelected having non-contiguous numeric keys in the first dimension ... That can be shorter and faster without the repeat loop: filter elements of tArray where ...
by rkriesel
Thu Apr 09, 2020 10:15 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Combination of list of word
Replies: 3
Views: 486

Re: Combination of list of word

18 words per sequence
18! sequences
5 bits per word (minimum to distinguish 18 individuals)
a billion bytes per gigabyte
~= 70 million gigabytes in your one file

You can be very sure, as you say, "there will be problems to do it."
-- Dick
by rkriesel
Thu Apr 09, 2020 4:40 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Combination of list of word
Replies: 3
Views: 486

Re: Combination of list of word

Hi, Alessio. See "https://en.wikipedia.org/wiki/Permutation" section "k-permutations of n" Since the formula for the number of k-permutations is n factorial, generating the sequences can be very time-consuming. Here's a summary from my code, which follows. name count,sequence count,milliseconds 2,2,...
by rkriesel
Thu Jan 23, 2020 7:50 am
Forum: Talking LiveCode
Topic: How to split a folder structure into an array with sub arrays?
Replies: 11
Views: 1623

Re: How to split a folder structure into an array with sub arrays?

...a list of full paths to the files within the specified folder ... The list of paths has the content for the array, so you can build the array without code to read directories: function arrayFromPaths pPaths local tArray, tFile set the itemDelimiter to "/" repeat for each line tPath in pPaths put...
by rkriesel
Mon Jan 20, 2020 11:37 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: combine two fields
Replies: 19
Views: 2536

Re: combine two fields

Hi, Larry. Here's a technique that may be faster, especially for longer lists, because it does not seek line n of each list for each and every n. function joinLines pList1, tList2, pLineDelimiter, pItemDelimiter -- join lines on line number local tLineNumber, tJoin split tList2 by pLineDelimiter set...
by rkriesel
Mon Dec 09, 2019 10:56 pm
Forum: Talking LiveCode
Topic: Concurrent loop/string processing to speed up Livecode
Replies: 21
Views: 2983

Re: Concurrent loop/string processing to speed up Livecode

Thanks. Yes, the description was clear enough. It host seemed a curious choice to have a specific string as the default value. I'm assuming there was a reason for that choice; it might be useful to know what that reason was. I'm guessing it was strictly arbitrary, you have to put *something* in the...
by rkriesel
Thu Dec 05, 2019 6:17 am
Forum: Talking LiveCode
Topic: Concurrent loop/string processing to speed up Livecode
Replies: 21
Views: 2983

Re: Concurrent loop/string processing to speed up Livecode

FourthWorld wrote:
Thu Dec 05, 2019 4:39 am
... I had forgotten about the "as set" option with the "split" command, but alas it's not mentioned in the dictionary. Where can I find a description of what that does?
Dictionary:split, section:Description, paragraph:6+

<aside>How could the dictionary evolve to help more?</aside>
by rkriesel
Thu Dec 05, 2019 3:48 am
Forum: Talking LiveCode
Topic: Concurrent loop/string processing to speed up Livecode
Replies: 21
Views: 2983

Re: Concurrent loop/string processing to speed up Livecode

Another way to speed up the processing is to eliminate the chunk counting, by invoking the split command. The code from [-hh] derives line numbers and word numbers within the lines of the text. The code from FourthWorld derives word numbers within the whole text. With split they're about 20% faster....
by rkriesel
Tue Oct 29, 2019 8:10 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Number combinations [Solved]
Replies: 13
Views: 1959

Re: Number combinations [Solved]

Bogs: Even though you don't care about speed for this app, perhaps much faster code would be interesting or illuminating. Some feel the need for speed. Hermann's nBits presents a good opportunity for eliminating a "repeat for each line" statement. Here's a version that produces the same output as nB...

Go to advanced search