Initial ternary representation options
Both parsing and conversion from T to ternary representation supported
This commit is contained in:
@ -88,6 +88,12 @@ toList (Fork x rest) = case toList rest of
|
||||
Left err -> Left err
|
||||
toList _ = Left "Invalid Tree Calculus list"
|
||||
|
||||
-- Outputs
|
||||
toTernaryString :: T -> String
|
||||
toTernaryString Leaf = "0"
|
||||
toTernaryString (Stem t) = "1" ++ toTernaryString t
|
||||
toTernaryString (Fork t1 t2) = "2" ++ toTernaryString t1 ++ toTernaryString t2
|
||||
|
||||
-- Utility
|
||||
type Env = Map.Map String T
|
||||
|
||||
|
Reference in New Issue
Block a user