diff options
author | Yuchen Pei <baconp@gmail.com> | 2017-06-22 18:57:14 -0400 |
---|---|---|
committer | Yuchen Pei <baconp@gmail.com> | 2017-06-22 18:57:14 -0400 |
commit | 863e44707e87e6a7722f412a41fff66575bbfcd2 (patch) | |
tree | f7d938dd7d63fb2039b9a50e69b2bb4f0a98705b /Math/Combinatorics |
first commit
Diffstat (limited to 'Math/Combinatorics')
-rw-r--r-- | Math/Combinatorics/YoungTableaux.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Math/Combinatorics/YoungTableaux.hs b/Math/Combinatorics/YoungTableaux.hs new file mode 100644 index 0000000..baa11c0 --- /dev/null +++ b/Math/Combinatorics/YoungTableaux.hs @@ -0,0 +1,11 @@ +isRowWord' :: Ord a => [a] -> [a] -> [a] -> Bool +isRowWord' _ ys [] = ys == [] +isRowWord' [] [] zs = isRowWord' [head zs] [] (tail zs) +isRowWord' xs [] zs = if last xs <= head zs then isRowWord' (xs ++ [head zs]) [] (tail zs) else isRowWord' [] xs zs +isRowWord' xs ys zs = + if xs == [] || last xs <= head zs + then head ys > head zs && (isRowWord' (xs ++ [head zs]) (tail ys) (tail zs)) + else ys == [] && isRowWord' [] xs zs + +isRowWord :: Ord a => [a] -> Bool +isRowWord = isRowWord' [] [] |