Hi list,
I am pleased to announce the first release of hmatrix-syntax [1], which
provides quasiquoters to provide a nice syntax for vectors and matrices in
Alberto Ruiz's excellent matrix package[2].
Examples:
> {-# LANGUAGE QuasiQuotes, ViewPatterns #-}
>
> import Data.Packed
> import Data.Packed.Syntax
> import Foreign.Storable
>
> -- vectors can be constructed and deconstructed
> swap :: Storable a => Vector a -> Vector a
> swap [vec| x, y |] = [vec| y, x |]
>
> -- matrices can be constructed and deconstructed
> adjugateMat2 :: (Storable a, Num a) => Matrix a -> Matrix a
> adjugateMat2 [mat| a, b; c, d |] = [mat| d, -b; -c, a |]
These constructions and deconstructions are expanded into direct array accesses.
Regards,
Reiner
[1]: http://hackage.haskell.org/package/hmatrix-syntax
[2]: http://hackage.haskell.org/package/hmatrix_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell