Re: [Haskell-cafe] Global Arrays

2012-03-12 Thread Clark Gaebel
Is there any proof of this? I'm not familiar enough with core to check. On Mon, Mar 12, 2012 at 3:48 AM, Ketil Malde wrote: > Clark Gaebel writes: > >> In Haskell, what's the canonical way of declaring a top-level array >> (Data.Vector of a huge list of doubles, in my case)? Performance is >> ke

Re: [Haskell-cafe] Global Arrays

2012-03-12 Thread Ketil Malde
Clark Gaebel writes: > In Haskell, what's the canonical way of declaring a top-level array > (Data.Vector of a huge list of doubles, in my case)? Performance is > key in my case. > > The straightforward way would just be something like: > > globalArray :: V.Vector Double > globalArray = V.fromLis

Re: [Haskell-cafe] Global Arrays

2012-03-10 Thread Clark Gaebel
Wouldn't that still have to loop through the array (or in this case, evaluate the monad) in order to use it the first time? On Sat, Mar 10, 2012 at 2:22 AM, Alexandr Alexeev wrote: >>> what's the canonical way of declaring a top-level array > Did you try State/StateT monads? > > 10 марта 2012 г.

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread Alexandr Alexeev
>> what's the canonical way of declaring a top-level array Did you try State/StateT monads? 10 марта 2012 г. 5:05 пользователь John Meacham написал: > On Fri, Mar 9, 2012 at 5:49 PM, Clark Gaebel > wrote: > > What's the advantage of using D.A.Storable over D.Vector? And yes, > > good call with

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread John Meacham
On Fri, Mar 9, 2012 at 5:49 PM, Clark Gaebel wrote: > What's the advantage of using D.A.Storable over D.Vector? And yes, > good call with creating an array of HSDouble directly. I didn't think > of that! Oh, looks like D.Vector has an unsafeFromForeignPtr too, I didn't see that. so D.Vector shou

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread Clark Gaebel
What's the advantage of using D.A.Storable over D.Vector? And yes, good call with creating an array of HSDouble directly. I didn't think of that! On Fri, Mar 9, 2012 at 8:25 PM, John Meacham wrote: > On Fri, Mar 9, 2012 at 12:48 PM, Clark Gaebel > wrote: >> static const double globalArray[] = {

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread John Meacham
On Fri, Mar 9, 2012 at 12:48 PM, Clark Gaebel wrote: > static const double globalArray[] = { huge list of doubles }; > double* getGlobalArray() { return globalArray; } > int        getGlobalArraySize() { return > sizeof(globalArray)/sizeof(globalArray[0]); } > > And importing it in haskell witht h

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread Lyndon Maydwell
Could template-Haskell be used somehow? - Lyndon Maydwell On Mar 10, 2012 4:50 AM, "Clark Gaebel" wrote: > In Haskell, what's the canonical way of declaring a top-level array > (Data.Vector of a huge list of doubles, in my case)? Performance is > key in my case. > > The straightforward way would

[Haskell-cafe] Global Arrays

2012-03-09 Thread Clark Gaebel
In Haskell, what's the canonical way of declaring a top-level array (Data.Vector of a huge list of doubles, in my case)? Performance is key in my case. The straightforward way would just be something like: globalArray :: V.Vector Double globalArray = V.fromList [ huge list of doubles ] {-# NOINLI