Copyright | Copyright (C) 2023 Yoo Chung |
---|---|
License | GPL-3.0-or-later |
Maintainer | dev@chungyc.org |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Some solutions to Problems.P70 of Ninety-Nine Haskell Problems.
Synopsis
- stringToMultitree :: String -> Maybe (MultiwayTree Char)
- multitreeToString :: MultiwayTree Char -> String
Documentation
stringToMultitree :: String -> Maybe (MultiwayTree Char) Source #
We suppose that the nodes of a multiway tree contain single characters.
The characters in the node string are in depth-first order of the tree.
The special character ^
is inserted whenever the move is
a backtrack to the previous level during tree traversal.
Note that the tree traversal will also backtrack from the root node of the tree.
Write a function to construct the MultiwayTree
when the string is given.
multitreeToString :: MultiwayTree Char -> String Source #
Construct the node string from a MultiwayTree
.