Dimitry Golubovsky writes:
Does there exist any analog of popen in the standard Haskell libraries?
Maybe System.Process.runInteractiveCommand is what you need?
http://haskell.org/ghc/docs/latest/html/libraries/base/System.Process.html
Peter
___
Ptr is defined in the FFI, which is documented here:
http://www.cse.unsw.edu.au/~chak/haskell/ffi/
and also in the GHC documentation:
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Foreign.Ptr.html
I haven't done much binary IO, so I'll let someone else handle that,
but there are
Hi Daniel,
Yes, importing Data.Char worked, but revealed other problems. Now I get the
following.
ERROR C:\Program Files\Hugs98\libraries\QuickCheck.hs:161 - Undefined variable
fromInt
Monad
This, however, I have seen before, and it has to do with different versions of
Prelude, where fromInt
Hi !
I'm trying to write a function that combines folding and mapping. This
function would take two arguments (a folding function and a mapping function),
and would return a function of one argument (a list of 'a''s) returning a 'a'.
The idea is to write something like sumsquare =
On Wed, 13 Apr 2005, Didier Verna wrote:
I'm trying to write a function that combines folding and mapping. This
function would take two arguments (a folding function and a mapping function),
and would return a function of one argument (a list of 'a''s) returning a 'a'.
The idea is to write
Hi
How come
foldr1 min [(maxBound::Int) % 1,1 % 2]
2147483647 % 1
but
foldr1 min [2147483647 % 1,1 % 2]
1 % 2
Why???
/Bo Herlin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Wed, 13 Apr 2005, Bo Herlin wrote:
Hi
How come
foldr1 min [(maxBound::Int) % 1,1 % 2]
2147483647 % 1
I guess that
foldr1 min == minimum
but
foldr1 min [2147483647 % 1,1 % 2]
1 % 2
Why???
The first one certainly causes an overflow with machine word Ints whereas
2147483647 is an Integer and
Hmm...
let a = (maxBound :: Int)%1 in 1 a a 1/2
== True
From the Ord instance for Ratio a
(x:%y) (x':%y') = x * y' x' * y
So the comparison for 1 a looks like
1 * 1 (maxBound :: Int) * 1
which is true.
And the comparison for a 1/2 looks like
(maxBound :: Int) * 2 1 * 1
== -2 1
I'm trying to write a function that combines folding and mapping
a map is a fold:)
idList = foldr (:) []
map f = foldr ((:) . f) []
foldmap :: (b - b - b) - (a - b) - [a] - b
foldmap f m = foldr1 f . map m
alternatively, and dealing with empty lists as well
foldmap op n f = foldr (op . f) n
I am learning Haskell and have set a small exercise for myself on a
frames and slots program.
Would appreciate some help on how to pass constructors of data
structures as arguments to a function.
Thanks,
-- Ralph
__
A
Frames test
module Frames
where
Define frame slots:
Hmm, too simple :-P ...Thanks
Henning Thielemann wrote:
On Wed, 13 Apr 2005, Bo Herlin wrote:
Hi
How come
foldr1 min [(maxBound::Int) % 1,1 % 2]
2147483647 % 1
I guess that
foldr1 min == minimum
but
foldr1 min [2147483647 % 1,1 % 2]
1 % 2
Why???
The first one certainly causes an overflow
Yep, got it, Thanks!
Cale Gibbard wrote:
Hmm...
let a = (maxBound :: Int)%1 in 1 a a 1/2
== True
From the Ord instance for Ratio a
(x:%y) (x':%y') = x * y' x' * y
So the comparison for 1 a looks like
1 * 1 (maxBound :: Int) * 1
which is true.
And the comparison for a 1/2 looks like
Am Mittwoch, 13. April 2005 15:43 schrieb Ralph Hodgson:
I am learning Haskell and have set a small exercise for myself on a
frames and slots program.
Would appreciate some help on how to pass constructors of data
structures as arguments to a function.
Thanks,
-- Ralph
snip
Now I need a
Henning Thielemann [EMAIL PROTECTED] wrote:
Do you mean
foldmap :: (b - b - b) - (a - b) - [a] - b
foldmap f m = foldr1 f . map m
But of course ! Thanks :-)
--
Didier Verna, [EMAIL PROTECTED], http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01
I don't really understand what you want to achieve : constructors are
functions, thus first class objects ...
I suppose you want a destructor, ie a function extracting the first name
from a property for example. You may want to have a look there :
http://haskell.org/hawiki/DecoratingStructures
Thanks for your help Daniel - I am clarifying my message
Daniel Fischer wrote:
Am Mittwoch, 13. April 2005 15:43 schrieb Ralph Hodgson:
I am learning Haskell and have set a small exercise for myself on a
frames and slots program.
Would appreciate some help on how to pass constructors of data
Am Mittwoch, 13. April 2005 17:14 schrieben Sie:
Thanks for your help Daniel - I am clarifying my message
I would like to see an example of passing constructors as arguments. I
am still getting familiar with constructs like:
getProperty ( a - b) - [ContactProperty] - b
I am not sure how
Peter Simons wrote:
Dimitry Golubovsky writes:
Does there exist any analog of popen in the standard Haskell libraries?
Maybe System.Process.runInteractiveCommand is what you need?
http://haskell.org/ghc/docs/latest/html/libraries/base/System.Process.html
Is this available only in 6.4? In 6.2.2
18 matches
Mail list logo