[Haskell-cafe] Re: Hints for Euler Problem 11

Aaron Denney wnoise at ofb.net
Thu Aug 16 16:27:08 EDT 2007


On 2007-08-16, Kim-Ee Yeoh <a.biurvOir4 at asuhan.com> wrote:
>
>
> Aaron Denney wrote:
>> 
>> On 2007-08-15, Pekka Karjalainen <p3k at iki.fi> wrote:
>>> A little style issue here on the side, if I may. You don't need to use
>>> (++) to join multiline string literals.
>>>
>>> text = "If you want to have multiline string literals \
>>>        \in your source code, you can break them up with \
>>>        \backslashes. Any whitespace characters between \
>>>        \two backslashes will be ignored."
>> 
>> I find the first far more readable.  The compiler should be able to
>> assemble it all at compile time, right?
>> 
>
> 'Course not. The (++) function like all Haskell functions is only a
> /promise/ to do its job. What does "assembling at compile time"
> mean here:
>
> s = "I will not write infinite loops " ++ s

It's a circular list of characters.  Quite feasible to do at compile
time.

-- 
Aaron Denney
-><-



More information about the Haskell-Cafe mailing list