Another thought, which I hesitate to even mention, would be to call the
commandline tool via System.Cmd, pipe the results to a file, and read
the file, and parse the results. Slow and ugly, but you could have it
working in an hour.
Hadn't even thought of that, must be my clean
Is there a way to get the number of dimension of an array ? i.e.
something like :
dims :: (Ix a) = Array a b - Int
dims = ...
a = listArray (1,10) [1,2..]
b = listArray ((1,1),(10,10)) [1,2..]
dims a -- should be equal to 1
dims b -- should be equal to 2
The key is somewhere in the Ix class but
At 10:59 29/03/04 +0100, Keith Wansbrough wrote:
Another thought, which I hesitate to even mention, would be to call the
commandline tool via System.Cmd, pipe the results to a file, and read
the file, and parse the results. Slow and ugly, but you could have it
working in an hour.
Hadn't
I think that adding the extra check to see if the pointers
are identical
sped this up enough that it's probably no longer a major
issue--I'm pretty
certain that the problem was large strings that were
identical, so every
byte had to be checked, so probably scary non-portable home-made
On Mon, 29 Mar 2004, Fred Nicolier wrote:
Is there a way to get the number of dimension of an array ? i.e.
something like :
dims :: (Ix a) = Array a b - Int
dims = ...
a = listArray (1,10) [1,2..]
b = listArray ((1,1),(10,10)) [1,2..]
dims a -- should be equal to 1
dims b -- should
Josef Svenningsson wrote:
In a sense Haskell arrays are always one dimensional. But as you noted
tuples are used to achieve higher dimensionality. As far as I know there
is no way of asking for the dimension of an array. You could write your
own class for that though. Here's a suggestion:
Sorry for sending this twice, but it seems to me that the newsgroup
fa.haskell only logs the discussion of haskell and haskell-cafe.
-- Forwarded message --
Date: Mon, 29 Mar 2004 01:18:27 -0800
From: [EMAIL PROTECTED] (Henning Thielemann)
Newsgroups: fa.haskell
Subject: Context
Could not deduce (Num a) from the context (VectorSpace VList)
The problem is in the definition:
zero = VList (repeat 0)
Is 0 an Int or an Integer?
To define zero, instances need to be parameterised by
vector type:
EG:
class VectorSpace v a where
zero :: v a
On Mon, Mar 29, 2004 at 06:00:57PM +0200, Henning Thielemann wrote:
Thus I setup a type constructor VectorSpace
in the following way:
module VectorSpace
where
class VectorSpace v where
zero :: v a
add :: v a - v a - v a
scale :: a - v a - v a
I haven't added