Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,31 @@
|
|||
void local fn Permute( string as CFStringRef, result as CFMutableArrayRef, current as CFStringRef )
|
||||
if ( len(string) == 0 ) then MutableArrayAddObject( result, current ) : return
|
||||
for NSUInteger i = 0 to len(string) - 1
|
||||
unichar c = fn StringCharacterAtIndex( string, i )
|
||||
CFMutableStringRef remainingStr = fn MutableStringWithString( string )
|
||||
MutableStringDeleteCharacters( remainingStr, fn RangeMake( i, 1 ) )
|
||||
CFStringRef newCurrent = fn StringByAppendingFormat( current, @"%C", c )
|
||||
fn Permute( remainingStr, result, newCurrent )
|
||||
next
|
||||
end fn
|
||||
|
||||
local fn DoPermutations as CFStringRef
|
||||
CFStringRef inputString = @"ABCD"
|
||||
CFMutableArrayRef array1 = fn MutableArrayNew
|
||||
fn Permute( inputString, array1, @"" )
|
||||
|
||||
CFArrayRef array2 = @[
|
||||
@"ABCD", @"CABD", @"ACDB", @"DACB", @"BCDA", @"ACBD",
|
||||
@"ADCB", @"CDAB", @"DABC", @"BCAD", @"CADB", @"CDBA",
|
||||
@"CBAD", @"ABDC", @"ADBC", @"BDCA", @"DCBA", @"BACD",
|
||||
@"BADC", @"BDAC", @"CBDA", @"DBCA", @"DCAB"]
|
||||
|
||||
CFMutableSetRef set1 = fn MutableSetWithArray( array1 )
|
||||
CFSetRef set2 = fn SetWithArray( array2 )
|
||||
MutableSetMinusSet( set1, set2 )
|
||||
return fn SetAnyObject( set1 )
|
||||
end fn = NULL
|
||||
|
||||
printf @"%@", fn DoPermutations
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue