Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
Permutations_By_Swapping(str, list:=""){
|
||||
ch := SubStr(str, 1, 1) ; get left-most charachter of str
|
||||
for i, line in StrSplit(list, "`n") ; for each line in list
|
||||
loop % StrLen(line) + 1 ; loop each possible position
|
||||
Newlist .= RegExReplace(line, mod(i,2) ? "(?=.{" A_Index-1 "}$)" : "^.{" A_Index-1 "}\K", ch) "`n"
|
||||
list := Newlist ? Trim(Newlist, "`n") : ch ; recreate list
|
||||
if !str := SubStr(str, 2) ; remove charachter from left hand side
|
||||
return list ; done if str is empty
|
||||
return Permutations_By_Swapping(str, list) ; else recurse
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
for each, line in StrSplit(Permutations_By_Swapping(1234), "`n")
|
||||
result .= line "`tSign: " (mod(A_Index,2)? 1 : -1) "`n"
|
||||
MsgBox, 262144, , % result
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue