On Wed, 13 Sep 2006, Bulat Ziganshin wrote:

> Wednesday, September 13, 2006, 1:12:35 PM, you wrote:
> 
> > Adding sugar or using Template Haskell for such a simple task is a bit
> > unreasonable. I think Tim should use mapM a little bit and then he will
> > probably need no longer a special syntax.
> 
> i disagree. lack of good syntax makes imperative programming in
> Haskell less convenient. i want to have such syntax in order to make
> Haskell great imperative language:
> 
> sum <- new 0
> arr <- new Array[1..3]
> for i in [1..3] do
>   sum += i
>   arr[i] := sum
> for i in [1..3] while arr[i]<2 do
>   print arr[i]

let arr = scanl1 (+) [1..3]
in  mapM_ print (takeWhile (<2) arr)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to