| (mild) culture shock here. It is typical for people in the Haskell
| community to view things in a rather principled way. A language
| tutorial is supposed to introduce /the language/. If you want to know
| how to compile or execute a Haskell program, well then, look at the
| appropriate
Folks,
How is one to interpret the following? I'm particularly interested in
the IO $ \ s - notatoin as I have never seen that before.
allocaBytes :: Int - (Ptr a - IO b) - IO b
allocaBytes (I# size) action = IO $ \ s -
case newPinnedByteArray# size s of { (# s, mbarr# #) -
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Moore
I suspect that the reference documentation is fine, and the tutorials
are great, given what they are trying to do. But there is scope for a
very prominent Getting going document. Daniel's 40-second intro to
Haskell
Converting to Ptr Word8 and storables took about an hour and gave me
a more favorable profile.
COST CENTREMODULE %time %alloc
reverse_ Script.Endian 14.4 13.4
sequ Script.Pickle 14.39.3
read
joelr1:
Folks,
How is one to interpret the following? I'm particularly interested in
the IO $ \ s - notatoin as I have never seen that before.
allocaBytes :: Int - (Ptr a - IO b) - IO b
allocaBytes (I# size) action = IO $ \ s -
case newPinnedByteArray# size s of { (# s,
Simon Peyton-Jones wrote:
I'm certain there are hurdles, but I think on the whole they are
there by accident rather than design.
Why certainly. I have never seen any on-line community that had hurdles
by design. Hurdles are usually due to the fact that the people who
design the
Folks,
It looks like I successfully squashed my time leaks and moving my
serialization to Ptr Word8 got me as close to the metal as possible.
I'm still getting wierd results, though, and they look like a time leak.
ORANGE ALERT: 0s, 6s, SrvServerInfo
ORANGE ALERT: 0s, 8s, SrvServerInfo
Hal Daume III wrote:
Daniel -- can you tell me what was missing from YAHT that wasn't
sufficient for starting to use Haskell? It was really intended to solve
these problems, at least partially, so if it's missing out, I'd like to
fix it!
I haven't read it. I refuse to give out personal
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Daniel Carrera
Hal Daume III wrote:
Daniel -- can you tell me what was missing from YAHT that wasn't
sufficient for starting to use Haskell? It was really
intended to solve
these problems, at least partially, so if
Bayley, Alistair wrote:
From this page
http://haskell.org/hawiki/LearningHaskell
there's a link to the tutorial
http://www.isi.edu/~hdaume/htut/tutorial.pdf
which seems to make no informational demands.
I suggest updating this page:
http://www.haskell.org/learning.html
To point to
On 12/20/05, Daniel Carrera [EMAIL PROTECTED] wrote:
Hi all,
I've finished a first draft of what I call First steps in Haskell.
It's intended to be the very first thing a new user sees when they
decide to try out Haskell.
http://www.haskell.org/hawiki/FirstSteps?action=show
It's a bit
Daniel -- can you tell me what was missing from YAHT that wasn't
sufficient for starting to use Haskell? It was really intended to solve
these problems, at least partially, so if it's missing out, I'd like to
fix it!
I haven't read it. I refuse to give out personal information to
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Daniel Carrera
Hi all,
I've finished a first draft of what I call First steps in Haskell.
It's intended to be the very first thing a new user sees when they
decide to try out Haskell.
Hello all,
Trying to learn Haskell here... In a Haskell tutorial I found a function
deciding if a number is prime:
--//--
prime n = not (factors 2 n)
factors m n | m == n = False
| m n = divides m n || factors (m+1) n
divides a b = (mod a b == 0)
--//--
Reference:
Hi Daniel!
How do I know that 38466629 is prime?
What about this: 38466629 = 31 x 1240859
Regards,
Jens
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
John Peterson wrote:
Add a type signature:
prime :: Integer - Bool
It's defaulting to Int and you're getting overflows
Thanks. Hmm... it's still not working.
Btw, I mis-reported the problem. The offending number is 38466629, which
is /not/ prime but the sample program reports as prime.
Jens Fisseler wrote:
What about this: 38466629 = 31 x 1240859
Yes, I wrote backwards. The offending program says that it's prime but
it's not.
Cheers,
Daniel.
--
/\/`) http://oooauthors.org
/\/_/ http://opendocumentfellowship.org
/\/_/
\/_/I am not over-weight, I am
Hi Daniel!
You just have to change the arguments of the 'mod'-function:
old: divides a b = (mod a b == 0)
new: divides a b = (mod b a == 0)
Regards,
Jens
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Daniel,
Could it be that the arguments to either divides or mod should be reversed?
Currently it seems to be testing whether the candidate prime (n)
divides the possible factor (m).
Or am I to tired to read the code straight?
Regards,
Maarten
On 12/20/05, Daniel Carrera [EMAIL PROTECTED]
On 12/20/05, Hal Daume III [EMAIL PROTECTED] wrote:
It seems a bit unfair to say that there are no good ways of learning
information about Haskell. Yes, I'm shamelessly plugging my own tutorial,
but that's because I think it's pretty good.
I agree, it is. I read it and found it a great help
-divides a b = (mod a b == 0)
+divides a b = (mod b a == 0)
On Dec 20, 2005, at 11:09 AM, Daniel Carrera wrote:
John Peterson wrote:
Add a type signature:
prime :: Integer - Bool
It's defaulting to Int and you're getting overflows
Thanks. Hmm... it's still not working.
Btw, I
Daniel Carrera [EMAIL PROTECTED] writes:
This function seems to produce a wrong result on the number 38466629
(warning, slow computation).
Here is an easier-to-find problem: it tells me the number 4 is prime.
Regards,
Malcolm
___
Haskell-Cafe
Hi guys,
I was wondering where I should get started in learing about
how to implement a haskell compiler?
Are there papers, wiki entries, or other things people think
would be helpful or should I just start looking at the
source of one of the compilers?
Robert Dockins wrote:
-divides a b = (mod a b == 0)
+divides a b = (mod b a == 0)
Oh, thanks. My program assumed one way to define 'divides' and the
example assumed the other.
When I wrote it I was thinking of (divides a) being a function that
tells me if the input divides 'a'.
Thanks!
Henning Thielemann wrote:
factors :: Integer - Integer - Bool
factors m n | m == n = False
| m n = divides m n || factors (m+1) n
Btw. I find the recursion harder to understand than the explicit
definition:
factors n = any (divides n) [2..(n-1)]
For what it's worth, I also
On Tue, 20 Dec 2005, Bayley, Alistair wrote:
...
There should be a getting started page which says:
- download and install this interpreter (Hugs or GHCi)
- run it, type these expressions, and see the results
- create a HelloWorld program, compile and execute.
- now start the following
You are braver than me, but I must confess I've had the same desire.
Here's a great place to start:
Simon Peyton Jones, David Lester, Implementing functional languages: a tutorial
http://research.microsoft.com/Users/simonpj/Papers/pj-lester-book/
It's long, (sort of old) and written in Miranda
Donn Cave wrote:
I understand that interactive mode can be useful, I'm just wondering
whether it belongs with Hello world in the scheme of things, or if
at that first step it would be better to focus on the language.
Let's compare sample instructions:
Interactive mode:
-
1.
I've finally performed test on amd64 and result is a same as on intel.
KMP always wins. So KMP is best suited for non indexed strings
and I guess should be used in library as prefered search/replace method.
This test favors straightforward search.
[EMAIL PROTECTED] myhaskell]$ time ./KMP
== So how do I write Hello, world? ==
Well, the first thing you need to understand that in a
functional language like Haskell, this is a harder
question than it seems. Most of the code you will write
in Haskell is purely functional, which means that it
returns the same thing every
On 20 Dec 2005 19:52:31 +0100, Peter Simons [EMAIL PROTECTED] wrote:
== So how do I write Hello, world? ==
Well, the first thing you need to understand that in a
functional language like Haskell, this is a harder
question than it seems. Most of the code you will write
in Haskell
Peter Simons wrote:
In my humble
opinion, it's unfortunate that many tutorials and
introductionary texts leave the impression that monadic code
would be something utterly different than normal Haskell
code. I feel it intimidates the reader by making a monad
appear like black magic, even though
From: Daniel Carrera [EMAIL PROTECTED]
Robert Dockins wrote:
-divides a b = (mod a b == 0)
+divides a b = (mod b a == 0)
Oh, thanks. My program assumed one way to define 'divides'
and the example assumed the other.
When I wrote it I was thinking of (divides a) being a
function that
You could also learn from the code and documentation of the various
implementations of Haskell: GHC, hugs, nhc, and
- YHC (http://www-users.cs.york.ac.uk/~ndm/yhc/) (an nhc derivatibe)
including a portable bytecode compiler
With Yhc, there is also a quite useful wiki at
On 17 December 2005 21:57, Ketil Malde wrote:
Simon Marlow [EMAIL PROTECTED] writes:
On 16 December 2005 10:05, Joel Reymont wrote:
I'm trying to restrict GHC to 800Mb of heap at runtime by passing in
+RTS -M800M, the machine has 1Gb of memory and top shows free
physical memory dropping
Daniel Carrera writes:
I'm scared of monads :) I really don't know what a monad
is.
Neither do I, but that doesn't mean that I can't use just
fine. ;-)
putStrLn :: String - World - World
That seems less scary.
Things become a lot clearer when you think about how to
print _two_ lines
On Tue, 2005-12-20 at 16:53 +, Daniel Carrera wrote:
Henning Thielemann wrote:
factors :: Integer - Integer - Bool
factors m n | m == n = False
| m n = divides m n || factors (m+1) n
Btw. I find the recursion harder to understand than the explicit
definition:
On Tue, 2005-12-20 at 20:07 +0100, Sebastian Sylvan wrote:
. . .
I'm still looking for a good *practical* tutorial that I could
recommend to newcomers.
IO, data types and QuickCheck in the very first chapter, I say! Real
program examples from the get go, and go into the theory on why this
Hi,
Hugs Interpreter onlySuitable for learning. You'll need GHC for
serious work.
This is putting Hugs down quite a bit. I personally prefer Hugs, and
use it for serious work (including developing a Haskell compiler, and
4 years of academic study and counting). About the only thing
Scherrer, Chad wrote:
module Main where
import A
import B
main = A.f B.f
module A where
f = ...
module B where
f = ...
in a single file. This example is straight from chapter 5 of the Report,
and no mention is made (that I could find) about modules needing to be
in
Daniel Carrera wrote:
Hello all,
I'm trying to write the simplest possible Haskell program, and I'm not
getting anywhere.
I have installed Hugs, GHC and GHCI. I want to run the following program:
fac :: Integer - Integer
fac 0 = 1
fac n | n 0 = n * fac (n-1)
$ ghci
Prelude let {
On Tuesday 20 December 2005 20:58, Peter Simons wrote:
Daniel Carrera writes:
I'm scared of monads :) I really don't know what a monad
is.
Neither do I, but that doesn't mean that I can't use just
fine. ;-)
putStrLn :: String - World - World
That seems less scary.
Things
Scherrer, Chad wrote:
Have you used Haskell's infix notation? It can help keep the order
straight for operators like these. You can write
a `mod` b -- instead of mod a b
a `divides` b -- instead of divides a b.
This can help with readability, too.
No, I haven't. That's neat, very neat.
On Mon, Dec 19, 2005 at 01:17:35PM -, Simon Peyton-Jones wrote:
| Actually, I have sometimes wished that the various interactive Haskell
| interfaces had the possibility to enter also declarations interactively
GHCi does.
ghci let f x = hello
ghci f True
True
But there's no
I still get timeouts with 5k threads. Not as often as with 1k before,
though.
On Dec 21, 2005, at 3:35 AM, Donald Bruce Stewart wrote:
It looks like with the 1000s of threads that get run, the problem is
just getting enough cpu time for each thread. All the solutions that
appear to work
On Tue, 20 Dec 2005, John Meacham wrote:
On Tue, Dec 20, 2005 at 10:36:36AM -0600, Creighton Hogg wrote:
I was wondering where I should get started in learing about
how to implement a haskell compiler?
Snip Absolute Awesomeness
Wow! That was a great response, with more references than
From: Bulat Ziganshin [EMAIL PROTECTED]
Reply-To: Bulat Ziganshin [EMAIL PROTECTED]
To: Branimir Maksimovic [EMAIL PROTECTED]
CC: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Substring replacements
Date: Tue, 20 Dec 2005 23:55:22 +0300
Hello Branimir,
Tuesday, December 20, 2005,
Hello Neil,
Tuesday, December 20, 2005, 11:52:51 PM, you wrote:
NM Hi,
Hugs Interpreter onlySuitable for learning. You'll need GHC for
serious work.
NM This is putting Hugs down quite a bit. I personally prefer Hugs, and
NM use it for serious work (including developing a Haskell
Hello S,
Friday, December 16, 2005, 6:32:47 AM, you wrote:
SKC Why not do this: name none of those modules Main.hs, and have an empty
SKC module Main.hs with only import MainDeJour and main =
SKC MainDeJour.main so you can just edit just that file.
ghc has option -main-is which is just what
49 matches
Mail list logo