thanks for all suggestions.
zaxis wrote:
For me i like C style instead of layout. For example,
func1 a = do
-- ...
a * 2
-- ...
I always write it as:
func1 a = do {
-- ...;
a * 2;
-- ...;
}
However, i donot know how to write pure function using C style.
On 2 Feb 2010, at 03:05, Richard O'Keefe wrote:
A simple hash-function for strings is to simply exclusive-or the
bytes and then reduce modulo a prime number,
Simply exclusive-oring the bytes will give you at most 256 distinct
results. (For an ASCII source, 128 distinct results.) After
hi I have a question about haskell coding.
Matrices
One of many ways to define matrices in Haskell is the list of matrix rows,
where a row is a list of double precision oating point numbers:
type Matrix=[[Double]]
Using this type you should define the following functions (definition of dim
is
Hi,
Try to understand this:
type Matrix = [[Double]]
multSM :: Double - Matrix - Matrix
multSM d m = map (\ i - map (\ j - d*j ) i) m
Now try this for multSM (instead of the above definition)
multSM = map . map . (*)
Hope it helps,
On 2 February 2010 09:35, 조광래 kwangrae...@gmail.com wrote:
|multSM d m = [[(b*a)| b-[d], a-(head m)]]
Well, let's see what do we have here.
We have []'s around something. Something is [(b*a)| b-[d], a-(head m)], which is just a legal Haskell value, so our mutlSM d m has to be a one-element list, with the only element being equal to
what we put
Hi all,
I'm trying to learn Haskell and have come across Monads. I kind of understand
monads now, but I would really like to understand where they come from. So I
got a copy of Barr and Well's Category Theory for Computing Science Third
Edition, but the book has really left me dumbfounded.
fac n = let {
f = foldr (*) 1 [1..n]
} in f
:D
sorry for double reply, need to cc cafe, this is fun.
On Tue, Feb 2, 2010 at 4:33 PM, zaxis z_a...@163.com wrote:
thanks for all suggestions.
zaxis wrote:
For me i like C style instead of layout. For example,
func1 a = do
-- ...
I should probably add that I am trying various proofs that involve injective
and surjective properties of Hom Sets and Hom functions.
Does anyone know what Hom stands for?
I need a text for a newbie.
Mark
On 02/02/2010, at 9:56 PM, Mark Spezzano wrote:
Hi all,
I'm trying to learn Haskell
Hom(A, B) is just a set of morphisms from A to B.
Mark Spezzano wrote:
I should probably add that I am trying various proofs that involve injective
and surjective properties of Hom Sets and Hom functions.
Does anyone know what Hom stands for?
I need a text for a newbie.
Mark
On 02/02/2010,
From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of zaxis
For me i like C style instead of layout. For example,
func1 a = do {
-- ...;
a * 2;
-- ...;
}
The report has all the gory details. The brace+semicolon syntax isn't
just
define functions
type Matrix=[[Double]]
multMM :: Matrix - Matrix - Matrix --multiplies two matrices
det :: Matrix - Double --computes the determinant of a matrix
inv :: Matrix - Matrix --inverts a matrix
i stuck on those problems
can any one help me out?
On 2 Feb 2010, at 13:15, 조광래 wrote:
define functions
type Matrix=[[Double]]
multMM :: Matrix - Matrix - Matrix --multiplies two matrices
det :: Matrix - Double --computes the determinant of a matrix
inv :: Matrix - Matrix --inverts a matrix
i stuck on those problems
can any one help me out?
Correction about the latter part...
In the end, I would write something like the following:
unGen arbitrary (mkStdGen 11) 5 :: [Int]
This produces, for example, [5,1,-2,-4,2]. I also want to generate the same
value for a type isomorphic to [Int].
unGen arbitrary (mkStdGen 11) 5 :: List
You may try Pierce's Basic Category Theory for Computer Scientists or
Awodey's Category Theory, whose style is rather introductory. Both of them
(I think) have a chapter about functors where they explain the Hom functor
and related topics.
Alvaro.
2010/2/2 Mark Spezzano
Mark Spezzano wrote:
I need a text for a newbie.
While the other books suggested are excellent, I think that they would
be hard going if you find Barr Wells difficult.
The simplest introduction to the ideas of category theory that I know is
Conceptual Mathematics by F W Lawvere S H
Hi all,
I was wondering if someone has written a tracer/debugger that shows you
how a given Haskell expression is evaluated, by generating all the
intermediate states of the expression until it is in normal form?
For instance, given the following code:
take' 0 xs = []
take' n (x:xs) = x :
I have a little haskell matrix library for fixed sized matricies on github:
http://github.com/jvranish/VectorMatix
which I've just realized is horribly out of date...I'll update it tonight
and probably push it to hackage too...
but if you're really want to stick with the [[Double]] type,
you can
Hello,
I've been writing some GUI application with Gtk2hs. It's an
interpreter for lambda-calculus and combinatory logic, it's GPL and if
you interested I can share it with cafe.
The problem is that the GUI code has become very ugly and I'm tempted
to rewrite it totally. I've been looking
Hi Cafe.
I've made a basic game of life implementation with Haskell and OpenGL:
https://github.com/sordina/Life/
The basic premise is to generate a random snapshot, then iterate the
successor function on it to create an infinite list of snapshots, then
output them using OpenGL. I haven't really
2010/2/2 Lyndon Maydwell maydw...@gmail.com:
Hi Cafe.
I've made a basic game of life implementation with Haskell and OpenGL:
https://github.com/sordina/Life/
I'm intending to improve the performance, and add more advanced
features, but I thought I'd get some feedback first. Can anyone see a
I chose the array mainly for the fast lookup time compared to lists,
are you suggesting something like creating a Map (X,Y) Health? I'm
not currently updating any structures, rather creating the successor
from scratch. I can see how the map may work very well for the sparse
nature of non-early
2010/2/2 Lyndon Maydwell maydw...@gmail.com:
I chose the array mainly for the fast lookup time compared to lists,
are you suggesting something like creating a Map (X,Y) Health? I'm
not currently updating any structures, rather creating the successor
from scratch. I can see how the map may work
I'm avoiding hard-coding bools anywhere as I intend to allow
fuzzy-representations at some point.
On Wed, Feb 3, 2010 at 12:10 AM, Serguey Zefirov sergu...@gmail.com wrote:
2010/2/2 Lyndon Maydwell maydw...@gmail.com:
I chose the array mainly for the fast lookup time compared to lists,
are you
http://hackage.haskell.org/package/hmatrix-0.8.1.1
it wraps gls, blas and lapack (so you need to install the libraries).
On Tue, Feb 2, 2010 at 4:08 PM, Job Vranish jvran...@gmail.com wrote:
I have a little haskell matrix library for fixed sized matricies on github:
On Tuesday 02 February 2010 16:10:05 Serguey Zefirov wrote:
Actually, your solution with arrays is the most often occured solution
an imperative programmer will come with. It is simple but not scalable
and not particularly fast.
What gave you that impression?
--
Dr Jon Harrop, Flying Frog
2010/2/2 Álvaro García Pérez agar...@babel.ls.fi.upm.es
You may try Pierce's Basic Category Theory for Computer Scientists or
Awodey's Category Theory, whose style is rather introductory. Both of them
(I think) have a chapter about functors where they explain the Hom functor
and related
Hi,
Hat: The Haskell Tracer.
http://www.haskell.org/hat/
From the site:
Hat helps locating errors in programs. Furthermore, it is useful for
understanding how a (correct) program works, especially for teaching and
program maintenance. Hat is not a time or space profiler. Hat can be used
for
2010/2/2 Lyndon Maydwell maydw...@gmail.com:
I'm avoiding hard-coding bools anywhere as I intend to allow
fuzzy-representations at some point.
What is the meaning of fuzzy Game of Life? Where can I read about?
Or you're planning to average field over some time interval?
In the latter case you
2010/2/2 Jon Harrop j...@ffconsultancy.com:
On Tuesday 02 February 2010 16:10:05 Serguey Zefirov wrote:
Actually, your solution with arrays is the most often occured solution
an imperative programmer will come with. It is simple but not scalable
and not particularly fast.
What gave you that
On Tuesday 02 February 2010 18:23:59 Serguey Zefirov wrote:
2010/2/2 Jon Harrop j...@ffconsultancy.com:
On Tuesday 02 February 2010 16:10:05 Serguey Zefirov wrote:
Actually, your solution with arrays is the most often occured solution
an imperative programmer will come with. It is simple
On Tue, Feb 2, 2010 at 11:54 AM, Jon Harrop j...@ffconsultancy.com wrote:
On Tuesday 02 February 2010 18:23:59 Serguey Zefirov wrote:
2010/2/2 Jon Harrop j...@ffconsultancy.com:
On Tuesday 02 February 2010 16:10:05 Serguey Zefirov wrote:
Actually, your solution with arrays is the most
2010/2/2 Jon Harrop j...@ffconsultancy.com:
Or, you're asking about scalability and speed?
I meant the scalability and speed. An imperative solution should be simpler,
more scalable and faster than any purely functional solution.
So, please, provide any and we'll discuss difference between
leimy2k:
On Tue, Feb 2, 2010 at 11:54 AM, Jon Harrop j...@ffconsultancy.com wrote:
On Tuesday 02 February 2010 18:23:59 Serguey Zefirov wrote:
2010/2/2 Jon Harrop j...@ffconsultancy.com:
On Tuesday 02 February 2010 16:10:05 Serguey Zefirov wrote:
Actually, your
Gen slightly breaks the monad laws:
arbitrary = return
is not the same as
return () = const arbitrary
because each bind splits the generator, so you end up with a different
seed passed to arbitrary in these two cases.
If the observable value is some random object this is a safe fudge,
but if
OK, I'm working on matrix stuff in Haskell now (I've been trying to get
the professor to approve that) and when I use cabal install to install
hmatrix, it fails at HUnit with:
---
Configuring HUnit-1.2.2.1...
Preprocessing library HUnit-1.2.2.1...
Preprocessing executables for
On Tue, Feb 2, 2010 at 1:59 PM, d...@patriot.net wrote:
OK, I'm working on matrix stuff in Haskell now (I've been trying to get
the professor to approve that) and when I use cabal install to install
hmatrix, it fails at HUnit with:
---
Configuring HUnit-1.2.2.1...
Preprocessing
On Tue, Feb 2, 2010 at 1:48 PM, Ryan Ingram ryani.s...@gmail.com wrote:
Gen slightly breaks the monad laws:
arbitrary = return
is not the same as
return () = const arbitrary
because each bind splits the generator, so you end up with a different
seed passed to arbitrary in these two cases.
Den 2. feb. 2010 kl. 19.26 skrev Jon Harrop j...@ffconsultancy.com:
On Tuesday 02 February 2010 16:10:05 Serguey Zefirov wrote:
Actually, your solution with arrays is the most often occured
solution
an imperative programmer will come with. It is simple but not
scalable
and not
I have tried to access a few of the documents on generics that are
referred to from wikipedia, from the GHC documentation, from hackage
and from the wiki. These documents (on vu.nl, subdirectory boilerplate
and strafunski) are apparently forbidden to me, and have been for some
weeks. I
Mark Spezzano mark.spezzano at chariot.net.au writes:
Maybe there are books on Discrete maths or Algebra or Set Theory that deal
more with Hom Sets and Hom Functions?
Googling haskell category theory I got:
http://en.wikibooks.org/wiki/Haskell/Category_theory
On Tue, Feb 2, 2010 at 20:25, David Menendez wrote:
On Tue, Feb 2, 2010 at 1:48 PM, Ryan Ingram wrote:
Gen slightly breaks the monad laws:
arbitrary = return
is not the same as
return () = const arbitrary
because each bind splits the generator, so you end up with a different
seed
I have tried to access a few of the documents on generics that are referred
to from wikipedia, from the GHC documentation, from hackage and from the
wiki. These documents (on vu.nl, subdirectory boilerplate and strafunski)
are apparently forbidden to me, and have been for some weeks. I tried to
On Tue, 2 Feb 2010, Arne D Halvorsen wrote:
If I may butt in here: to get a scalable, fast Game of Life, you should look
into Hashlife (by Gosper?) as exemplified in the open source application
Golly. It gives an astonishing speedup, and it would be interesting to see it
expressed in Haskell.
On Tue, 2 Feb 2010, Serguey Zefirov wrote:
Creation of new Array is (without knowing some subtle details) is
O(max coordinates difference between live cells). Creation of new Set
(X,Y) is O(NlogN) (N = number of live objects). Most of the cells in
Life are empty, so the Set/Map approach is
http://dotat.at/prog/life/hslife.hs
[],
Edgar
On Tue, 02/Feb/2010 at 21:10 +0100, Arne D Halvorsen wrote:
Den 2. feb. 2010 kl. 19.26 skrev Jon Harrop j...@ffconsultancy.com:
On Tuesday 02 February 2010 16:10:05 Serguey Zefirov wrote:
Actually, your solution with arrays is the most often
On Tue, Feb 2, 2010 at 11:25 AM, David Menendez d...@zednenem.com wrote:
We could avoid that problem by redefining Gen as a state transformer monad.
newtype Gen a = MkGen { unGen :: StdGen - Int - (a, StdGen) }
Unfortunately, this makes things like
infinite_xs - sequence (repeat arbitrary)
I'd also be happy to mentor. Where is the official place to collect
project ideas? We used trac previously, are we still using it or are
we now on Reddit?
Thanks, Neil
2010/2/1 sterl s.clo...@gmail.com:
Malcolm Wallace wrote:
Google has announced that the Summer of Code programme will be
Although now that I think about it, most of these could be pretty
easily fixed by a new primitive:
splitGen :: Gen a - Gen a
splitGen m = MkGen spg where
spg g n = (a, g2) where
(g1, g2) = split g
(a, _) = unGen m g1 n
Then you could do
infinite_xs - splitGen $
Hi,
I maintain the Haskell package HLint. HLint depends on
haskell-src-exts, cpphs, hscolour and uniplate, plus things which are
shipped with GHC. For each of the external library dependencies, I
have to specify a version constraint. For example, I developed HLint
against cpphs-1.10 so I can
On Tue, Feb 2, 2010 at 2:06 PM, Neil Mitchell ndmitch...@gmail.com wrote:
I'd also be happy to mentor. Where is the official place to collect
project ideas? We used trac previously, are we still using it or are
we now on Reddit?
Is there a way to prune the reddit list? Some of the projects
I emailed Simon Peyton Jones about this a few weeks ago (he links to
these pages) and got the reply thanks, will chase - so people are
aware of it. The links are in many places, which is a bit of a shame.
Thanks, Neil
On Tue, Feb 2, 2010 at 8:51 PM, Arne Dehli Halvorsen arne@gmail.com wrote:
On Tue, 2 Feb 2010, ed...@ymonad.com wrote:
http://dotat.at/prog/life/hslife.hs
Er, yes, I didn't link to that in my earlier message because it's a
half-completed attempt. I think I got to the stage of realising that I
needed to write a monad or a monad transformer to thread the hash cons
state
Hello
The most of the papers the Wikipedia page links to should be publicly
accessible, I've just checked the ones hosted at Utrecht University
(e.g the Generic Haskell manual and Andres L\ohs thesis). Ralf Hinze
has changed universities, so the link to
A few days ago I changed the links from the SYB wiki [1] to point to an
archived version of the vu.nl webpage:
http://web.archive.org/web/20080622204226/http://www.cs.vu.nl/boilerplate/
But it would be nice to have the webpage up again, somewhere.
Cheers,
Pedro
[1]
On Tue, Feb 2, 2010 at 11:11 PM, Neil Mitchell ndmitch...@gmail.com wrote:
Alternatively, if I could sign up to be emailed when something went
wrong, I'd happily fix it. i.e. I'd like an email either when my
package fails to compile against the latest version of all packages
but within my
Apologies for the rather garbled last message (I was trying to type
whilst checking a multitude of links in a plethora or browser
windows)...
The SYB papers are here
http://research.microsoft.com/en-us/um/people/simonpj/Papers/hmap/
The code seems to have vanished at the moment, maybe someone
Alternatively, if I could sign up to be emailed when something went
wrong, I'd happily fix it. i.e. I'd like an email either when my
package fails to compile against the latest version of all packages
but within my constrained range, or when the latest version falls
outside my constraint
On Tue, Feb 2, 2010 at 5:11 PM, Johan Tibell johan.tib...@gmail.com wrote:
On Tue, Feb 2, 2010 at 2:06 PM, Neil Mitchell ndmitch...@gmail.com wrote:
I'd also be happy to mentor. Where is the official place to collect
project ideas? We used trac previously, are we still using it or are
we now
2010/1/31 Malcolm Wallace malcolm.wall...@cs.york.ac.uk:
Both of these roles are called mentor in the Google system. Putting
together a good team of mentors before applying as an organisation is
helpful towards us being accepted into the programme.
Having experienced being a student on the
On Feb 3, 2010, at 1:15 AM, 조광래 wrote:
define functions
type Matrix=[[Double]]
multMM :: Matrix - Matrix - Matrix --multiplies two matrices
det :: Matrix - Double --computes the determinant of a matrix
inv :: Matrix - Matrix --inverts a matrix
i stuck on those problems
Stuck how, exactly?
I understood the simple but not scalable and not particularly fast
claim *NOT* as a claim about imperative languages but in context as
a claim about using two-dimensional arrays of booleans to implement
Conway's Life. One message in this thread has already pointed to a
solution (in C) that in
Hi all,
I wonder if there is some a field of use overlap between HList and
functional references aka accessors.
Do both tackle the same problem?
Günther
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Thanks for the replies.
I have heard of Hash Life, but I thought I'd try a more naive approach
first, build up some type-classes, then create some more interesting
implementations (although I think I'd struggle with implementing Hash
Life in haskell at this point).
What is the meaning of fuzzy
fac n = let { f = foldr (*) 1 [1..n] } in f
VERY interesting :)
Jinjing Wang wrote:
fac n = let {
f = foldr (*) 1 [1..n]
} in f
:D
sorry for double reply, need to cc cafe, this is fun.
On Tue, Feb 2, 2010 at 4:33 PM, zaxis z_a...@163.com wrote:
thanks for all suggestions.
network-fancy fails to build because Not in scope: 'setNonBlockingFD'. Any
pointers to what should be used in 6.12?
/M
--
Magnus Therning(OpenPGP: 0xAB4DFBA4)
magnus@therning.org Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter:
On Tue, Feb 2, 2010 at 4:41 PM, Magnus Therning mag...@therning.org wrote:
network-fancy fails to build because Not in scope: 'setNonBlockingFD'.
Any
pointers to what should be used in 6.12?
I have the following in 'network':
#if __GLASGOW_HASKELL__ 611
On Tuesday 02 February 2010 23:54:58 Richard O'Keefe wrote:
I understood the simple but not scalable and not particularly fast
claim *NOT* as a claim about imperative languages but in context as
a claim about using two-dimensional arrays of booleans to implement
Conway's Life.
Fair enough. If
Neil Mitchell ndmitch...@gmail.com writes:
However, every time I use (1) some distro (usually Arch) emails me to
say they need wider ranges so they can get all their packages
consistent.
Well, in Gentoo we normally resort to using sed to fix these kinds of
things. If we can do it, I'm sure
man manuel.a.cas...@gmail.com writes:
http://hackage.haskell.org/package/hmatrix-0.8.1.1
it wraps gls, blas and lapack (so you need to install the libraries).
There's also the blas package if you just want blas support.
--
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
On 3 Feb 2010, at 02:04, Jon Harrop j...@ffconsultancy.com wrote:
On Tuesday 02 February 2010 23:54:58 Richard O'Keefe wrote:
One message in this thread has already pointed to a
solution (in C) that in effect uses a bit-packed sparse
representation
to achieve high speed. The point is that
On Tuesday 02 February 2010 18:44:25 David Leimbach wrote:
On Tue, Feb 2, 2010 at 11:54 AM, Jon Harrop j...@ffconsultancy.com wrote:
I meant the scalability and speed. An imperative solution should be
simpler, more scalable and faster than any purely functional solution.
That's a pretty
This is identical to the homework problem posted on stackoverflow:
http://stackoverflow.com/questions/2182300/haskell-matrix-scalar-multilple-question
Do not post homework problems to the cafe!
If you feel compelled to then identify an aspect that is tricky to
you, show us what you tried, and
On Wednesday 03 February 2010 01:08:33 Richard O'Keefe wrote:
On Feb 3, 2010, at 3:04 PM, Jon Harrop wrote:
Fair enough. If you want to model either an infinite board or a very
sparse one then a sparse data structure will be asymptotically faster. But
they won't be simpler and
Hello Victor,
2010/2/2, Victor Nazarov asviraspossi...@gmail.com:
I've been writing some GUI application with Gtk2hs. It's an
interpreter for lambda-calculus and combinatory logic, it's GPL and if
you interested I can share it with cafe.
Sure, why not?
I consider more lightweight and more
On Feb 2, 2010, at 7:11 PM, Jon Harrop wrote:
I doubt programming paradigms live or die according to whether or not they
can
implement Conway's Game of Life simply and efficiently.
This makes an awesome quote. :-)
- Greg
___
Haskell-Cafe
On Tue, Feb 2, 2010 at 7:33 PM, Gregory Crosswhite
gcr...@phys.washington.edu wrote:
On Feb 2, 2010, at 7:11 PM, Jon Harrop wrote:
I doubt programming paradigms live or die according to whether or not
they can
implement Conway's Game of Life simply and efficiently.
This makes an awesome
Gregory Crosswhite gcr...@phys.washington.edu writes:
On Feb 2, 2010, at 7:11 PM, Jon Harrop wrote:
I doubt programming paradigms live or die according to whether or not they
can
implement Conway's Game of Life simply and efficiently.
This makes an awesome quote. :-)
You mean Jon
Looking at (for example) the docs for 'bracket'[1], the parameter
documentation has been shifted up by one. The source code[2] looks
correct, so perhaps Haddock is parsing it incorrectly? Docs for other
functions, such as 'showSigned'[3], exhibit the same error.
[1]
hi i was trying to solve it but
All i got is
type Matrix=[[Double]]
multMM :: Matrix - Matrix - Matrix --multiplies two matrices
multMM m t =[[sum (zipWith (*) (head m)(a)) ] ]where a = [head a | a-
t]
Main multMM [[2,1,-6],[1,-3,2]] [[1,0,-3],[0,4,20],[-2,1,1]]
[[14.0]]
from this i
79 matches
Mail list logo