Re: [Haskell-cafe] Can you do everything without shared-memory concurrency?

2008-09-10 Thread Jed Brown
On Wed 2008-09-10 09:05, David Roundy wrote: 2008/9/9 Jed Brown [EMAIL PROTECTED]: On Tue 2008-09-09 12:30, Bruce Eckel wrote: So this is the kind of problem I keep running into. There will seem to be consensus that you can do everything with isolated processes message passing

Re: [Haskell-cafe] Can you do everything without shared-memory concurrency?

2008-09-09 Thread Jed Brown
On Tue 2008-09-09 12:30, Bruce Eckel wrote: So this is the kind of problem I keep running into. There will seem to be consensus that you can do everything with isolated processes message passing (and note here that I include Actors in this scenario even if their mechanism is more complex). And

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Jed Brown
On Wed 2008-08-27 16:21, Jules Bean wrote: Bulat Ziganshin wrote: Hello haskell-cafe, solving one more task that uses English dictionary, i've thought: why we don't yet have pure hashtable library? There is imperative hashtables, pretty complex as they need to rebuild entire table as it

Re: [Haskell-cafe] Haskell Speed Myth

2008-08-25 Thread Jed Brown
On Sun 2008-08-24 11:03, Thomas M. DuBuisson wrote: Yay, the multicore version pays off when the workload is non-trivial. CPU utilization is still rather low for the -N2 case (70%). I think the Haskell threads have an affinity for certain OS threads (and thus a CPU). Perhaps it results in a

Re: [Haskell-cafe] Bug with QuickCheck 1.1 and GHC 6.8.2

2008-08-14 Thread Jed Brown
On Wed 2008-08-13 16:58, Patrick Perry wrote: variant :: Int - Gen a - Gen a variant v (Gen m) = Gen (\n r - m n (rands r !! v')) where v' = abs (v+1) `mod` 1 rands r0 = r1 : rands r2 where (r1, r2) = split r0 This sort of defeats the purpose of variant since it is now a nearly

Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Jed Brown
On Thu 2008-05-29 19:19, Tom Harper wrote: Why not just read it into a lazy ByteString? Are you looking to use an array with elements of a different type? You could then convert it to a strict ByteString. Because I'm writing the Unicode-friendly ByteString =p Uh, ByteString is

Re: [Haskell-cafe] Re: Copying Arrays

2008-05-29 Thread Jed Brown
On Thu 2008-05-29 18:45, Chad Scherrer wrote: Jed Brown jed at 59A2.org writes: Uh, ByteString is Unicode-agnostic. ByteString.Char8 is not. So why not do IO with lazy ByteString and parse into your own representation (which might look a lot like StorableVector)? One problem you

Re: [Haskell-cafe] Endianess

2008-05-13 Thread Jed Brown
On Tue 2008-05-13 20:46, Ketil Malde wrote: Aaron Denney [EMAIL PROTECTED] writes: I guess it depends a lot on what you grew up with. The names (little/big endian) are incredibly apt. The only argument I can come up with, is that big endian seems to make more sense for 'od': % echo

Re: [Haskell-cafe] Unboxed arrays

2008-03-26 Thread Jed Brown
On Wed 2008-03-26 14:22, Henning Thielemann wrote: A light-weight unboxed array variant is: http://code.haskell.org/~sjanssen/storablevector/ There is also CArray which offers an immutable interface for any Storable. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/carray You can

Re: [Haskell-cafe] Unboxed arrays

2008-03-26 Thread Jed Brown
On Wed 2008-03-26 19:50, Bulat Ziganshin wrote: Hello Jed, Wednesday, March 26, 2008, 7:02:28 PM, you wrote: StorableArray. Unfortunately there is a performance hit to using Storable versus the built in unboxed types. are you sure? it was in ghc 6.4, now afair they should be the

Re: [Haskell-cafe] floating point operations and representation

2008-03-17 Thread Jed Brown
On 17 Mar 2008, [EMAIL PROTECTED] wrote: Hello David, Monday, March 17, 2008, 7:59:09 PM, you wrote: foreign import ccall unsafe math.h log10 c_log10 :: CDouble - CDouble log10 :: Double - Double log10 x = realToFrac (c_log10 (realToFrac x)) It's a bit sloppier, but shouldn't cause any

Re: [Haskell-cafe] [GSoC] A data parallel physics engine

2008-03-12 Thread Jed Brown
On 12 Mar 2008, [EMAIL PROTECTED] wrote: I'm looking for interesting project to work on during Google Summer of Code. So I found [1]A data parallel physics engine ticket and got excited about it. I'd like to know interested mentors and community opinion about the complexity of such project.

Re: [Haskell-cafe] ANN: two new packages: carray, fft

2008-02-15 Thread Jed Brown
On 15 Feb 2008, [EMAIL PROTECTED] wrote: On Thu, 14 Feb 2008, Jed Brown wrote: Hopefully these are mature enough to be generally useful. I would appreciate any comments regarding the interface. The FFTW API is not particularly nice for building a pure interface on. because FFTW stores

Re: [Haskell-cafe] ANN: two new packages: carray, fft

2008-02-15 Thread Jed Brown
On 15 Feb 2008, [EMAIL PROTECTED] wrote: On Fri, 15 Feb 2008, Jed Brown wrote: On 15 Feb 2008, [EMAIL PROTECTED] wrote: On Thu, 14 Feb 2008, Jed Brown wrote: Hopefully these are mature enough to be generally useful. I would appreciate any comments regarding the interface

[Haskell-cafe] ANN: two new packages: carray, fft

2008-02-14 Thread Jed Brown
Hopefully these are mature enough to be generally useful. I would appreciate any comments regarding the interface. The FFTW API is not particularly nice for building a pure interface on. Some of the transforms could be made slightly faster at the expense of a much nastier interface, but unless

Re: [Haskell-cafe] Create a list without duplicates from a list with duplicates

2008-02-08 Thread Jed Brown
On 8 Feb 2008, [EMAIL PROTECTED] wrote: Hallo! Let's suppose I have a list [a,b,c,d,c,d]. I'd like to write a function that returns a new list without duplicates (in the example [a,b,c,d]). How can I do that? What is the most general way? I'd like to use the same function for a list of

Re: [Haskell-cafe] Re: Generic permutations

2008-01-26 Thread Jed Brown
On 26 Jan 2008, [EMAIL PROTECTED] wrote: The problem you solved can be solved much more elegantly: pms : [a] - Int - [[a]] pms xs n = foldM combine [] (replicate n xs) where combine rest as = liftM (:rest) as or, for the unreadable version: pms xs n = foldM (map . flip (:)) [] $ replicate

Re: [Haskell-cafe] Access to list

2008-01-13 Thread Jed Brown
On 13 Jan 2008, [EMAIL PROTECTED] wrote: If I define the follwoing functions: car (x:_) = x car [] = [] This won't typecheck. It helps to add a type signature car :: [a] - a The first element of an empty list is undefined, so you can do what Prelude.head does and write: car [] =

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Jed Brown
On 17 Dec 2007, [EMAIL PROTECTED] wrote: Ooo The constructor of a newtype must have exactly one field but `R' has two In the newtype declaration for `Rectangle' It doesn't like newtype Rectangle = R Int Int You want data Rectangle = R Int Int A newtype declaration will be completely

Re: [Haskell-cafe] array documentation is missing

2007-12-14 Thread Jed Brown
On 14 Dec 2007, [EMAIL PROTECTED] wrote: but I got stuck fixing it because the array documentation isn't there http://www.haskell.org/ghc/docs/latest/html/libraries/haskell98/Array.html Try the hierarchical library docs:

Re: [Haskell-cafe] library to read/write audio files

2007-12-11 Thread Jed Brown
On 11 Dec 2007, [EMAIL PROTECTED] wrote: Also, sound data is currently read into a list. I will probably change this at some point in the future, most likely copying the lazy bytestring implementation and using a list of CFloat arrays. Perhaps you are looking for storablevector which is a

Re: [Haskell-cafe] general

2007-12-08 Thread Jed Brown
On 8 Dec 2007, [EMAIL PROTECTED] wrote: Function A is a function that passes its input into B Function B is a function that does something once. How do I make it so function A is done multiple times without adding a third function? By this, do you mean that you have functions f, g f :: a

Re: [Haskell-cafe] Clean Dynamics and serializing code to disk

2007-12-05 Thread Jed Brown
On 5 Dec 2007, [EMAIL PROTECTED] wrote: Since from my Lisp days I know that code is data, it strikes me that one could probably somehow smuggle Haskell expressions via this route although I am not sure this is a good way to go or even how one would do it (to turn, say, a list of the chosen

Re: [Haskell-cafe] Re: Re: Re: Hit a wall with the type system

2007-11-30 Thread Jed Brown
On 30 Nov 2007, [EMAIL PROTECTED] wrote: Sure. To be more specific, here's the contract I would really like. 1. You need to pass in a polymorphic function a - a, where a is, at *most*, restricted to being an instance of Floating. This part I can already express via rank-N types. For