You could handle (some) larger combinatorials (and speed up the code) by modifying like so:
function __factorialFloor x,f if x <= f then return 1 return x * __factorialFloor(x-1,f) end __factorialFloor function __nCombFloor n, r if (r > 0) or (r <= n) then \ return __factorialFloor(n,max(r,n-r))/__factorial(min(r,n-r)) Answer "nComb error:" && r && "is not between 0 and" && n exit to top end __nCombFloor Of course, to handle even more/larger possible values you could decompose the arguments to their prime factors and eliminate dupes rather than divide, but this was a fairly easy optimization. On Sun, Feb 1, 2015 at 12:02 PM, Michael Doub <miked...@gmail.com> wrote: > Release 24 > * added: > __Zap - a function that returns only POSIX printable characters, > space, tab and return from a > string > __GetRegexMatches - Finds all the matches of pregex in ptext and > returns a list of the > start,end char positions > __deleteExtraTokens - This fuction witll remove sequences of the > specified token that are greater than > one. > __combinatorial - returns all possible subsets of a set, where n = # > of objects in the set > __nComb - Returns the # of combinations of n objects taken r at a time > __factorial - Returns x! > __latLongDist - Finds distances between two points based on Latitude > and Longitude > __dd2dms - Converts a digital longitude or Latitude into degrees, > minutes, seconds, direction format. > __dms2dd - Converts a degrees, minutes, seconds, direction longitude or > latitude to digital format > > https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0 > > Enjoy... > > _______________________________________________ > 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