[Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Juan Miguel Vilar
Hello, café: I am trying to use more than one array with runSTUArray but I don't seem to be able to understand how it works. My first try is this: test1 n = runSTUArray $ do a - newArray (1, n) (2::Int) b - newArray (1, n) (3::Int) forM_ [1..n] $ \i - do

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Daniel Fischer
On Thursday 15 March 2012, 19:27:18, Juan Miguel Vilar wrote: Hello, café: I am trying to use more than one array with runSTUArray but I don't seem to be able to understand how it works. My first try is this: test1 n = runSTUArray $ do a - newArray (1, n) (2::Int)

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Anthony Cowley
On Thursday, March 15, 2012 at 2:27 PM, Juan Miguel Vilar wrote: Hello, café: I am trying to use more than one array with runSTUArray but I don't seem to be able to understand how it works. My first try is this: test1 n = runSTUArray $ do a - newArray (1, n) (2::Int) b - newArray (1,

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Daniel Fischer
On Thursday 15 March 2012, 19:53:56, Daniel Fischer wrote: On Thursday 15 March 2012, 19:27:18, Juan Miguel Vilar wrote: Hello, café: However, when I write test2 n = runSTUArray $ do let createArray v n = newArray (1, n) (v::Int) Here you create a local binding

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Juan Miguel Vilar
El 15/03/12 20:07, Daniel Fischer escribió: On Thursday 15 March 2012, 19:53:56, Daniel Fischer wrote: On Thursday 15 March 2012, 19:27:18, Juan Miguel Vilar wrote: Hello, café: However, when I write test2 n = runSTUArray $ do let createArray v n = newArray (1, n)

Re: [Haskell-cafe] Trying to use more than one array in runSTUArray

2012-03-15 Thread Juan Miguel Vilar
El 15/03/12 19:53, Anthony Cowley escribió: On Thursday, March 15, 2012 at 2:27 PM, Juan Miguel Vilar wrote: Hello, café: I am trying to use more than one array with runSTUArray but I don't seem to be able to understand how it works. My first try is this: test1 n = runSTUArray $ do a -