bertram.felgenhauer:
Donald Bruce Stewart wrote:
High performance strings on the shootout:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcollang=all
interesting alternative programs
0.5 Haskell GHC #5 1.2990,880270
1.0 Clean
Hello,
I would like to create a Haskell function that generates a truth table, for all
Boolean values, say, using the following and function :
and :: Bool - Bool - Bool
and a b = a b
I have tried creating a second function called loop, which repeatedly calls
and, but it did not work, because,
[EMAIL PROTECTED] wrote:
I would like to create a Haskell function that generates a truth table, for all
Boolean values, say, using the following and function :
and :: Bool - Bool - Bool
and a b = a b
What is the type of the resulting table?
I have tried creating a second function called
Ketil,
thanks for you help.
Here's the code:
and2 :: Bool - Bool - Bool
and2 a b = a b
loop = [ and2 x y | x - [True,False], y - [True,False] ]
Now, how do I have Haskell print
printStrLn(True and True = ) + result of calling and2 True True
printStrLn(True and False = ) + result of
It would be better to produce a triple (as was suggested)
loop = [(x, y, xy) | x - [True, False], y - [True, False]]
The you can map a function that prints over that. Or even better
map a function that generates the strings, and the use one big
putStr at the end. Always try to separate IO
[EMAIL PROTECTED] wrote:
Ketil,
thanks for you help.
Here's the code:
and2 :: Bool - Bool - Bool
and2 a b = a b
loop = [ and2 x y | x - [True,False], y - [True,False] ]
Now, how do I have Haskell print
printStrLn(True and True = ) + result of calling and2 True True
printStrLn(True and
Quoth [EMAIL PROTECTED], nevermore,
loop = do
and True True
and True False
and False True
and False False
For this construct to work you'd have to have 'and' as a monadic
function - let's say, for argument's sake, in IO. And because there are
no results being
On Mon, 2007-02-05 at 19:26 -0800, Stefan O'Rear wrote:
I have a structure:
data Attr = Attr { fg :: !Color,
bg :: !Color,
bold :: !Bool,
blink :: !Bool,
rv :: !Bool,
halfBright :: !Bool,
Can anyone explain why Shape.Polygon would have a different type to
(Shape).Polygon, I thought the brackets would be redundant. Here is
the output from a Hugs session
Animation :v
-- Hugs Version 20050113
Animation :t Shape
Shape :: Shape - Region
Animation :t Polygon
Polygon :: [Vertex] - Shape
Can anyone explain why Shape.Polygon would have a different type to
(Shape).Polygon, I thought the brackets would be redundant. Here is
the output from a Hugs session
Animation :v
-- Hugs Version 20050113
Animation :t Shape
Shape :: Shape - Region
Animation :t Polygon
Polygon ::
Hello,
how would you convert Boolean triples to strings, in the IO function?
printStrings :: (Bool,Bool,Bool) - IO ()
phiroc
Quoting Lennart Augustsson [EMAIL PROTECTED]:
It would be better to produce a triple (as was suggested)
loop = [(x, y, xy) | x - [True, False], y - [True, False]]
I wrote:
Cale Gibbard's MonadRandom... I would like to suggest
a change to the interface...
class (Monad m) = MonadRandom m where
nextR :: m Int
splitR :: m (m ())
rangeR :: m (Int, Int)
getR :: (forall g . RandomGen g = g - a) - m a
I see that I have inadvertently done two things
On Tue, Feb 06, 2007 at 12:12:09PM +1100, Donald Bruce Stewart wrote:
And note that strings aren't a bottleneck anymore!
http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcollang=all
I think Haskell GHC #2 doesn't play by the rules:
diff program output for this 6KB
Hello haskell-cafe,
this seems like a comprehensive overview of FP facilities in C# 3.0:
http://blogs.msdn.com/madst/archive/2007/01/23/is-c-becoming-a-functional-language.aspx
--
Best regards,
Bulat mailto:[EMAIL PROTECTED]
On 2/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hello,
how would you convert Boolean triples to strings, in the IO function?
printStrings :: (Bool,Bool,Bool) - IO ()
Take a look at 'show':
Prelude show True
True
martin
___
Haskell-Cafe
apfelmus wrote:
I'm unsure whether it's a good idea to simulate
the situations, I'd prefer a more denotational
approach...
Queuing theory is a very large and mature area of
research, with many important applications in
industry. It is not a coincidence that a certain
telephone company named a
Queuing theory is a very large and mature area of
research, with many important applications in
industry. It is not a coincidence that a certain
telephone company named a functional programming
language after Erlang, the founder of queuing
theory.
Erlang actually stands for Ericsson Language. I
Bjorn Lisper wrote:
Erlang actually stands for Ericsson Language. I think the alternative
interpretation is intentional, though.
According to this:
http://www.erlang.org/pipermail/erlang-questions/1999-February/98.html
A.K.E. was the actual origin, but with an intentional ambiguity.
I am just coming to haskell, and I wrote a simple command to get some
input from a pdf file
I just wanted the output of the command so I did something like
import System.Process (runInteractiveCommand)
import IO (hGetContents)
-- | returns the text of the first page of the pdf at the given
fmohamed:
I am just coming to haskell, and I wrote a simple command to get some
input from a pdf file
I just wanted the output of the command so I did something like
import System.Process (runInteractiveCommand)
import IO (hGetContents)
-- | returns the text of the first page of the
[...]
Wait for the process to terminate, using
waitForProcess pid
Thanks fro the prompt response Don, I should have said it, but I knew
about waitForProcess pid but I did not want to use it.
The reason is the following, if I do
getTextOfPdf pdfPath = do
(inp,out,err,pid) -
I am replying to myself, but anyway with it seems (from the
documentation) that
forkIO (do{ waitForProcess pid; return () })
is the best solution, and does not seem to lead to wasted resources.
Anyway I am still interested in knowing if there are better
solutions, or other places where
Hi all,
Reading the sources of Lava (a Haskell Hardware Description DSL) I run
into this definition ...
unsafeCoerce :: a - b
unsafeCoerce a = unsafePerformIO $
do writeIORef ref a
readIORef ref
where
ref = unsafePerformIO $
do newIORef undefined
Is this actually equivalent to the
J. Garrett Morris wrote:
Again, from the earlier example, I'm not sure how typing:
apply :: (MonadCont m, MonadState Blargh m, MonadError Fzzt m, MonadIO m) =
Handle - Attribute a - m a
is simpler than
apply :: Handle - Attribute a - m a
Well, no, but it is at least no worse than
apply
Hi Alfonso,
Reading the sources of Lava (a Haskell Hardware Description DSL) I run
into this definition ...
unsafeCoerce :: a - b
Is this actually equivalent to the infamous unsafeCoerce# ?
Yes, see the comment in the haddock documentation for unsafePerformIO:
The splittable idea isn't mine, it looks like perhaps Remi Turk did it.
One thing which I'd recommend is including getRandom, getRandomR as
implemented in terms of getR and the ordinary random operations,
simply because they're the two most common uses, it's probably worth
it to define them
On 2/6/07, Bulat Ziganshin [EMAIL PROTECTED] wrote:
Hello haskell-cafe,
this seems like a comprehensive overview of FP facilities in C# 3.0:
http://blogs.msdn.com/madst/archive/2007/01/23/is-c-becoming-a-functional-language.aspx
If it ain't pure, it ain't functional! ;-)
--
Sebastian
Dear All,
For the last year I've been working on a program to translate between
Haskell and Java. Originally this was for my third year dissertation to
contribute towards my Masters in computer science at Sheffield
University, UK.
I have been given the opportunity to continue this project and
Hi Ricky,
For the last year I've been working on a program to translate between
Haskell and Java. Originally this was for my third year dissertation to
contribute towards my Masters in computer science at Sheffield University,
UK.
I have been given the opportunity to continue this project and
On 2/6/07, Ricky Barefield [EMAIL PROTECTED] wrote:
I've tried running Happy on these files but get the error `Not enough type arguments for
the type synonym P' when I try to run the resultant Parser.hs in Hugs and
similar errors when run in GHC.
What I'm trying to achieve is to read the
Mikael Johansson wrote:
I read sigfpe and got interested.
I read sigsegv and got interested :)
Jesse
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Feb 6, 2007, at 8:39 PM, David Waern wrote:
Wait for the process to terminate, using
waitForProcess pid
I've a sketch for a nice wrapper for the low level process code here,
http://www.cse.unsw.edu.au/~dons/code/newpopen/
What's missing? I'd like to use it, but I don't like
I've always found recursive solutions to problems elegant and I've
always been fed up of people telling me that I should rewrite
recursive solutions iteratively. (Annoying as it is, many people do
that.) I complained about this on K5 and solicited some opinions from
others on whether or not they
Hello,
the following code
---
import Stdm -- From Discrete Mathematics Using a Computer, by
Cordelia Hall and John O'Donnell.
pImpliesQAndR :: [Bool] - Bool
pImpliesQAndR (p:q:r:[]) = p == ( q /\ r )
Philippe de Rochambeau wrote:
I have tried
map (putStrLn) pImpliesQAndRLoopShow
but that results in the following error message:
Try
mapM_ putStrLn pImpliesQAndRLoopShow
or
putStrLn $ unlines pImpliesQAndRLoopShow
Regards,
Yitz
___
Haskell-Cafe
Heh. I still remember in my first Comp Sci class, in C, I had to take
a 2-line recursive tree traversal...and write it iteratively (in like
50 lines).
On 2/6/07, Dan Piponi [EMAIL PROTECTED] wrote:
I've always found recursive solutions to problems elegant and I've
always been fed up of people
6 feb 2007 kl. 22.33 skrev Fawzi Mohamed:
On Feb 6, 2007, at 8:39 PM, David Waern wrote:
Wait for the process to terminate, using
waitForProcess pid
I've a sketch for a nice wrapper for the low level process code
here,
http://www.cse.unsw.edu.au/~dons/code/newpopen/
What's
On 1/28/07, Alexy Khrabrov [EMAIL PROTECTED] wrote:
How do people stumble on Haskell?
I came at it from two angles:
General interest in actor languages led me to Io
(http://www.iolanguage.com), which used Darcs for its RCS at the time,
which led me to look at the source code for it, which got
davve:
Wait for the process to terminate, using
waitForProcess pid
I've a sketch for a nice wrapper for the low level process code here,
http://www.cse.unsw.edu.au/~dons/code/newpopen/
What's missing? I'd like to use it, but I don't like unreleased
libraries :)
Last time I
Hi,
Am Dienstag, den 06.02.2007, 15:56 +0100 schrieb Fawzi Mohamed:
I am replying to myself, but anyway with it seems (from the
documentation) that
forkIO (do{ waitForProcess pid; return () })
is the best solution, and does not seem to lead to wasted resources.
This does not work
mail:
Hi,
Am Dienstag, den 06.02.2007, 15:56 +0100 schrieb Fawzi Mohamed:
I am replying to myself, but anyway with it seems (from the
documentation) that
forkIO (do{ waitForProcess pid; return () })
is the best solution, and does not seem to lead to wasted resources.
Udo Stenzel wrote:
Benjamin Franksen wrote:
Udo Stenzel wrote:
Sure, you're right, everything flowing in the same direction is usually
nicer, and in central Europe, that order is from the left to the right.
What a shame that the Haskell gods chose to give the arguments to (.)
and ($) the
Hi,
Apologies for referring to this old thread...
I rearranged the code a little bit while experimenting but retained
the same behaviour:
Prelude let f = undefined :: Int - IO Int
Prelude (f 3 f 3) `seq` 42
42
Prelude (f 3) `seq` 42
*** Exception: Prelude.undefined
I think
I am still working on it. Some external events have slowed me down a
little (research, classes, appendicitis), and it has involved more
changes to the innards of GHC than anticipated, but it is still
moving along. If you can wait a little while, it should be possible
to use GHC.
A slight
On 2/6/07, Yitzchak Gale [EMAIL PROTECTED] wrote:
J. Garrett Morris wrote:
Well, no, but it is at least no worse than
apply :: Handle - Attribute a -
ContT (StateT Blargh (ErrorT Fzzt IO)) a
I find that in general, many functions do
not need all of the capabilities. If they do,
you can alias
45 matches
Mail list logo