
21 Jul
2005
21 Jul
'05
3:24 a.m.
On Thu, Jul 21, 2005 at 04:55:15PM +1000, Bernard Pope wrote:
On Wed, 2005-07-20 at 17:06 +0100, Andy Gimblett wrote:
show (Prefix l p) = "(" ++ l ++ "->" ++ show p ++ ")" show (External p q) = "(" ++ show p ++ " [] " ++ show q ++ ")"
but to me the extensive use of ++ is not particularly readable.
It is also inefficient because append has complexity proportional to the length of its left argument. That's why the Prelude defines:
type ShowS = String -> String
and functions like showsPrec, shows, showChar
It's not that bad in this case, because ++ is right-associative. Best regards Tomasz