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
permurations(Xs, Pss) :- | |
findall(Ys, permutace(Xs, Ys), Pss). | |
permList(Xs, AkYss, Yss) :- | |
permutace(Xs, Ys), | |
\+member(Ys, AkYss), | |
permList(Xs, [Ys|AkYss], Yss), !. | |
permList(_, AkYss, Yss) :- | |
reverse(AkYss, Yss), !. |
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
data Tree a = Tree a [Tree a] deriving Show | |
label :: Tree a -> Tree (a, Int) | |
label t = label' 1 t | |
label' :: Int -> Tree a -> Tree (a, Int) | |
label' i (Tree x []) = Tree (x, i) [] | |
label' i (Tree x ts) = | |
let | |
processed = goThrough i ts |
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
module CFG where | |
type NT = String | |
type T = String | |
data RightSide = NTs (NT, NT) | Term T deriving (Show, Eq, Ord) | |
type Rule = (NT, RightSide) | |
type CFG = [Rule] |
NewerOlder