2016-02-28 13:01 GMT+01:00 Terence Heaford <t.heaf...@icloud.com>: > Thanks, > > That is a good solution which will also apply to Max. > > I just thought that anything that can be rolled into the engine would be > faster and > usually every tick/millisecond that can be gained is worth having in an > interpreted language. > > > Well, as I don't know your context, I'm not sure if speed is really a problem here?
Anyway, you make me feel curious about this, and I've checked the speed against 3 variants. First, I generated 2 lists of numbers. repeat with i=1 to 1000 get random( 1000) put IT & cr after LinesOfNumbers put IT & comma after OneLineOfNumbers end repeat delete last char of LinesOfNumbers delete last char of OneLineOfNumbers Then, run: put 100 into nRepeat put the milliseconds into _ct -- case 1 repeat nRepeat put min( replaceText( LinesOfNumbers, return,comma)) into min1 end repeat put (the milliseconds - _ct) / nRepeat into timing1 wait 1 ticks with messages put the milliseconds into _ct -- case 2 repeat nRepeat replace return with comma in LinesOfNumbers put min( LinesOfNumbers) into min2 end repeat put (the milliseconds - _ct) / nRepeat into timing2 wait 1 ticks with messages put the milliseconds into _ct -- case 3 repeat nRepeat put min( OneLineOfNumbers) into min3 end repeat put (the milliseconds - _ct) / nRepeat into timing3 answer format( "Done in %.2f - %.2f - %.2f /%s", timing1, timing2, timing3, min1 is min2) Trying it few times for a list of 1000 items, we have the winner which obviously is case 3: 1,47 ms case 1 is 1,85 ms and case 2 is 4,5 ms. Increase the number of items to 10000, then you'll see much more distant results. But now, if you 're working with a list of 10 items, it really doesn't matter as the result are: 0,07 0,04, 0,03 ms Hope you find this interesting. Thierry > > Thierry Douez <th.do...@gmail.com> wrote: > > > > What about this? > > > > return min( replaceText( myListOfNumbers, "\n",comma)) > > > > > > 2016-02-28 12:05 GMT+01:00 Terence Heaford <t.heaf...@icloud.com>: > > > >> > >> I thought Min may work with the itemDelimiter but apparently not. > >> > >> Is that something that would be useful? > >> > >> set the itemDelimiter to return > >> > >> return Min (myListOfNumbers) — based on return not comma > - - ------------------------------------------------ Thierry Douez - http://sunny-tdz.com sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage _______________________________________________ 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