Last active
January 1, 2016 05:25
-
-
Save greymd/53ff6a5c33c11177ac47 to your computer and use it in GitHub Desktop.
1,2,3の3つの数字を並び替えた時の全パターンを列挙する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo {1,2,3}{1,2,3}{1,2,3}'\n' | awk '$1=$1' | sed -nr '/(.)(.?)\1/!p' | |
123 | |
132 | |
213 | |
231 | |
312 | |
321 | |
$ echo 1 2 3 | egison -F1,1c -T -m '(match-all-lambda (multiset integer)[<cons $a <cons $b <cons $c _>>> [a b c "#_EOF_#"]])' | sed -r 's/\t"#_EOF_#"\t?/\n/g' | awk -F '\t' '$1=$1' | |
1 2 3 | |
1 3 2 | |
2 1 3 | |
2 3 1 | |
3 1 2 | |
3 2 1 | |
# こんなコマンドがあったらなぁ | |
$ echo 1 2 3 | egison-sed -m '<cons $a <cons $b <cons $c _>>>' 'a b c' | |
1 2 3 | |
1 3 2 | |
2 1 3 | |
2 3 1 | |
3 1 2 | |
3 2 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment