Re: [Haskell-cafe] Best way to build strings?

2005-07-24 Thread Vadim Konovalov
I wish to toss out a new thought. To that end let me blow up the example to underline a scalability issue: A. q ++ ++ a ++ ++ z ++ [ ++ m ++ - ++ k ++ | ++ p ++ | ++ g ++ - ++ c ++ ] ++ h ++ ++ b ++ ++ f ++ ++ i B. printf %s %s %s [%s - %s |%s| %s - %s] %s %s %s %s q a z m

Re: [Haskell-cafe] Best way to build strings?

2005-07-24 Thread Jonathan Cast
Albert Lai [EMAIL PROTECTED] wrote: snip I wish to toss out a new thought. To that end let me blow up the example to underline a scalability issue: A. q ++ ++ a ++ ++ z ++ [ ++ m ++ - ++ k ++ | ++ p ++ | ++ g ++ - ++ c ++ ] ++ h ++ ++ b ++ ++ f ++ ++ i B. printf

Re: [Haskell-cafe] Best way to build strings?

2005-07-24 Thread Jonathan Cast
Jonathan Cast [EMAIL PROTECTED] wrote: Albert Lai [EMAIL PROTECTED] wrote: snip The best of both worlds may be something like the notation in the HOL theorem prover: ``^q ^a ^z [^m - ^k |^p| ^g - ^c] ^h ^b ^f ^i`` Do you agree that this is much better? Could someone implement

Re: [Haskell-cafe] Best way to build strings?

2005-07-23 Thread Albert Lai
Andy Gimblett [EMAIL PROTECTED] writes: show (External p q) = ( ++ show p ++ [] ++ show q ++ ) but to me the extensive use of ++ is not particularly readable. [...] return (%s [] %s) % (self.p, self.q) which to me seems clearer, or at least easier to work out roughly what

Re: [Haskell-cafe] Best way to build strings?

2005-07-21 Thread Tomasz Zielonka
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

Re: [Haskell-cafe] Best way to build strings?

2005-07-21 Thread Bernard Pope
On Thu, 2005-07-21 at 09:24 +0200, Tomasz Zielonka wrote: 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 ++ )

Re: [Haskell-cafe] Best way to build strings?

2005-07-20 Thread Bryn Keller
How about this? instance Show Process where show Stop = Stop show (Prefix l p) = concat [(, l, -, show p, )] show (External p q) = concat [(, show p, [] , show q, )] Hope that helps, Bryn Andy Gimblett wrote: A small stylistic question: what's the best way to build strings

Re: [Haskell-cafe] Best way to build strings?

2005-07-20 Thread Lemmih
On 7/20/05, Andy Gimblett [EMAIL PROTECTED] wrote: A small stylistic question: what's the best way to build strings containing other values? For example, I have: data Process = Stop | Prefix String Process | External Process Process instance Show Process

Re: [Haskell-cafe] Best way to build strings?

2005-07-20 Thread Tomasz Zielonka
On Wed, Jul 20, 2005 at 07:00:22PM +0200, Lemmih wrote: On 7/20/05, Andy Gimblett [EMAIL PROTECTED] wrote: Is there a facility like this in Haskell? Or something else I should be using, other than lots of ++ ? There's Text.Printf: Prelude Text.Printf printf (%s [] %s) hello world ::