> I have a file with 100 lists, with 100 ints.
>
> I have to read the file and apply the map and sort functions on lists.
>
> II did it to read file:
>
> learquivo :: FilePath -> IO ([[Int]])
> learquivo s = do
> conteudo <- readFile s
> return (read conteudo)
>
On Mon, 18 Oct 2010, Gilmara Pompelli wrote:
Hello
I have a file with 100 lists, with 100 ints.
I have to read the file and apply the map and sort functions on lists.
II did it to read file:
learquivo :: FilePath -> IO ([[Int]])
learquivo s = do
conteudo <- readFile s
On Sat, 2009-05-30 at 09:06 -0700, newuser21 wrote:
> Hi, I am new to haskell.
BTW, in future it's better to ask these kinds of questions on the
haskell-cafe mailing list. These days the main haskell mailing list is
mostly for announcements etc.
> I have an programm whitch i want to compile for w
Hello,
On Tuesday 13 January 2009 18:26, bft wrote:
> Hi !
> Can someone tell me where to download the *data* and *concurrent *packages.
I recall data and concurrent packages from some years back, but I would assume
that they are merged into the base package nowadays where GHC-6.10.1 is the
lat
Hello robert,
Sunday, August 19, 2007, 6:52:59 PM, you wrote:
> I defined
> newMem s = newIOArray (0, size-1) 0
> and then
> x = newMem 30
i recommend you to read http://haskell.org/haskellwiki/IO_inside
--
Best regards,
Bulatmailto:[EMAIL PROTECTED]
_
robert bauer wrote:
> I have an IOArray, but it doesn't work the way I expected it to.
>
> I defined
>
> newMem s = newIOArray (0, size-1) 0
>
> and then
>
> x = newMem 30
>
> then
>
> do {
>y <- x
> ; v <- readIOArray y 2
> ; print v
> ; writeIOArray y 2 20
> ; v <- readIOArray y 2
>
that is exact the way, how i had learned about the state monads like IO and
Maybe.
that was even before i understood the [] monad, folding and using Random; i
don't remember when that was... ghc-5.xx age.
in my opinion, unsafePerformIO is a good learning tool, as soon as you use it
tricky to an
import System.IO.Unsafe (unsafePerformIO,unsafeInterleaveIO)
Whoa! I'd be very cautious recommending these for newbies ...
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
module Dice where
import System.Random
import System.IO.Unsafe (unsafePerformIO,unsafeInterleaveIO)
import Data.List (unfoldr)
dice4,dice6,dice8,dice10,dice12,dice20,dice666 :: [Int]
dice4 = randomRs (1,4) (read "foo"::StdGen)
dice6 = randomRs (1,6) (mkStdGen 5)
dice8 = randomRs (1,8) (unsafePerf
I need some random numbers.
in the IO Monad, hiding the use of a generator
do x <- randomRIO (0, 1 :: Double) ; print x
you can also make the state explicit:
do g0 <- getStdGen ; let { ( x, g1 ) = randomR ( 0, 1::Double) g0 } ;
print x
a RandomGen is actually the state object for the ge
On 2 dec 2006, at 22.13, Cat Dancer wrote:
I'd like to write a server accepting incoming network connections that
can be gracefully shutdown.
When the server is asked to shutdown, it should stop accepting new
connections, finish processing any current connections, and then
terminate.
Clients c
After more testing I found an ugly problem that a child could be killed before
the finally installed the handler that calls (putMVar doneMVar ())
Thus I have added slightly more paranoid code to ensure that the child is
running
before exposing the (T)MVar/ThreadId to the rest of the application.
I realized there is another problem, since my code holds onto the ThreadId's
the thread
data structures may or may not be getting garbage collected and for a long
running
server the list of children grows without bound.
So I changed it to periodically clean out the finished child threads from th
Cat Dancer wrote:
>> > I'd certainly be most happy not to use asynchronous exceptions as the
>> > signalling mechanism, but how would you break out of the accept,
>> > except by receiving an asynchronous exception?
>>
>> Short Version: You trigger a graceful exit using a TVar...
>> ...and then you
Cat Dancer wrote:
> On 12/2/06, Chris Kuklewicz <[EMAIL PROTECTED]> wrote:
>> Hi, I have taken a crack at this. The best thing would be not to use the
>> asynchronous exceptions to signal the thread that calls accept.
>
> I'd certainly be most happy not to use asynchronous exceptions as the
> sig
On 12/2/06, Chris Kuklewicz <[EMAIL PROTECTED]> wrote:
Hi, I have taken a crack at this. The best thing would be not to use the
asynchronous exceptions to signal the thread that calls accept.
I'd certainly be most happy not to use asynchronous exceptions as the
signalling mechanism, but how wo
Hi, I have taken a crack at this. The best thing would be not to use the
asynchronous exceptions to signal the thread that calls accept. And use STM
more, since the exception semantics are much easier to get right.
But a few minor changes gets closer to what you want. First, the main problem
yo
On 2005-02-07 20:36:55 +, pablo daniel rey wrote:
> data Dir = Left | Right | Up | Down
> data Piece = Vertical | Horizontal | CodeA | CodeB
>
> the error i get :
>
> Instances of (Eq Dir, Eq Piece) required for definition of chgDir
You try to compare Dir and Piece values without having told
Matthew Walton <[EMAIL PROTECTED]> writes:
> (==) works on types which are members of the Eq typeclass. You can
> define this instance manually, or, since your type is nice and simple,
^^
> you can get Haskell to derive it for
pablo daniel rey wrote:
hello
i'm new to haskell so i'm sorry if this is a stupid question, but i'm having
problems with some basic code.
the code :
data Maybe Dir = Just Dir | Nothing
data Dir = Left | Right | Up | Down
data Piece = Vertical | Horizontal | CodeA | CodeB
flow = [(Horizontal, Left,
Georg Martius writes:
> Hi folks,
>
> I would like to use Arrows, but I just can't figure out how to
> actually use them. I looked at various documentations including the
> API doc [1], the Wiki [2], [3], and some random pages on the net but
> didn't find a single simple example that tells me how
> Then we get the problem when we use difST in distString.
I no such problem.
The Glorious Glasgow Haskell Compilation System, version 6.3
ghc -H32m -Wall -O2 -fvia-C -optc-O2 -optc-march=pentium3 -optc-mfpmath=sse
-fexcess-precision -fliberate-case-threshold100 -funbox-strict-fields -threaded
On Tue, 2004-06-29 at 23:38, MR K P SCHUPKE wrote:
> Try this:
>
> distString :: String -> String -> Int
> distString s0 s1 = let a = runST (difST s0 s1)
>in a!(1,1)
>
> difST :: MArray (STUArray s) Int (ST s) => String -> String -> ST s (UArray
> (Int,Int) Int)
> difST s0 s1 = do
>b@(_,
Try this:
distString :: String -> String -> Int
distString s0 s1 = let a = runST (difST s0 s1)
in a!(1,1)
difST :: MArray (STUArray s) Int (ST s) => String -> String -> ST s (UArray (Int,Int)
Int)
difST s0 s1 = do
b@(_,br) <- return $ (\x1 y1 -> ((0,0),(x1,y1))) (length s0) (length s1)
On Tue, 2004-06-29 at 18:42, MR K P SCHUPKE wrote:
> Erm, something I remember about needing MArrays... Here's something
> which does the same thing (cooks and MArray then freezes it - also using
> STUArray... The neat thing is MArray is a class, so you can swap between
> STUArray and STArray imple
Erm, something I remember about needing MArrays... Here's something
which does the same thing (cooks and MArray then freezes it - also using
STUArray... The neat thing is MArray is a class, so you can swap between
STUArray and STArray implementations without changing code.
This is the classic dyna
TECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: Haskell help!
>
>
> Currently I'm having problems with type checking due to Haskell being a
> strongly typed language. In order to return all optimal solutions, my
> professor suggested I create a list of
-- Weitergeleitete Nachricht --
Subject: Re: Haskell help!
Date: Wed, 26 Mar 2003 23:57:42 +0100
From: Marc Ziegert <[EMAIL PROTECTED]>
To: "Weix, Rachel Lynn" <[EMAIL PROTECTED]>
i'm just programming the solution.
imagine a matrix / a rectangle
G'day.
Some general advice...
On Wed, Mar 26, 2003 at 04:30:08PM -0600, Weix, Rachel Lynn wrote:
> Currently I'm having problems with type checking due to Haskell being
> a strongly typed language.
Problems with type checking are almost never caused by Haskell being
a strongly typed language.
Title: Re: Haskell help!
P.S. The example given is for the set of sequences/strings
(The,Masters)
-Original Message- From: Weix, Rachel
Lynn Sent: Wed 3/26/2003 4:30 PM To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED] Subject: RE: Haskell
help!
Currently I'm h
Title: Re: Haskell help!
Currently I'm having problems with type checking due to Haskell being a
strongly typed language. In order to return all optimal solutions, my
professor suggested I create a list of tuples if they all have the same score,
as indicated in my new maxSeq method
Title: Re: Haskell help!
I have since been able to figure out my problems - the algorithm for one of
my methods was wrong and I found two "typos" so to speak. I now need to
figure out how to return all optimal solutions, and I have an idea as to how to
start. If I have any mor
hi,
the paper i posted uses Haskell, no mutation or looping. it also uses
Haskell's lazyness in a neat way.
bye
iavor
Weix, Rachel Lynn wrote:
I have since been able to figure out my problems - the algorithm for one of my methods was wrong and I found two "typos" so to speak. I now need to figu
hi,
i think you might find the following paper relevant:
"Algebrainc Dynamic Prorgamming"
by Robert Gigerich and Carsten Meyer
http://link.springer-ny.com/link/service/series/0558/papers/2422/24220349.pdf
bye
iavor
Weix, Rachel Lynn wrote:
Hi,
I'm a college student trying to write a Haskell prog
looks like a genetic algorithm, i've programmed years ago. :)
i need the sourcecode to solve the problem.
it seems that you "zip" the two strings together:
unzip $ zip "abcde" "123"
->
unzip [('a','1'),('b','2'),('c','3')]
->
("abc","123")
i've no idea why you got "saaturn".
- marc
Am Diens
35 matches
Mail list logo