Dear all,
https://github.com/nushio3/practice/blob/master/recursion-schemes/FibTest.hs
After learning fix-point operators, I found an answer by myself.
```
fibBase :: (Integer - Integer) - Integer - Integer
fibBase fib n
| n = 1= 1
| otherwise = fib (n-1) + fib (n-2)
fibWithFix ::
In an attempt to understand why cata- and anamorphisms are considered so
important, I found multiple implications that you can write any recursive
functions in terms of nonrecursive functions and ana, cata (am I right
here?) so I'm trying to practice the rewrite by a few functions. I'm
following a
Dear haskellers,
I'd like assistance figuring out a strange space leak using zlib
package.
To make it easier to reproduce I've come up with the following snippet
that pretty much resumes up the problem I'm trying to solve:
-- omitting imports and function signatures
encode = compress .
Sorry, I should've removed the pid number from the output. The
following should be correct:
$ sudo dd if=/dev/sda bs=4K count=2048K | ./test +RTS -M1M -s /dev/null
...
8589934592 bytes (8.6 GB) copied, 243.525 s, 35.3 MB/s
41,942,119,192
I think it might be impossible with type families. I don't think it's
possible to differentiate with type families something like T a a, and T a
b, with b different from a.
I think that you would need overlap to write this.
On 27 February 2013 12:01, Raphael Gaschignard dasur...@gmail.com wrote:
I think it might be impossible with type families. I don't think it's
possible to differentiate with type families something like T a a, and T a
b, with b different from a.
It's indeed impossible to write such type
Dmitry Kulagin wrote:
I try to implement typed C-like structures in my little dsl.
HList essentially had those
http://code.haskell.org/HList/
I was unable to implement required type function:
type family Find (s :: Symbol) (xs :: [(Symbol,Ty)]) :: Ty
Which just finds a type in a
That seems to be very relevant to my problem (especially HList.Record).
Am I right that UndecidableInstances is required mostly because of eq on
types, like in this instances:
class HRLabelSet (ps :: [*])
instance HRLabelSet '[]
instance HRLabelSet '[x]
instance ( HEq l1 l2 leq
,
Very clear solution, I will try to adopt it.
Thank you!
On Wed, Feb 27, 2013 at 12:17 PM, Aleksey Khudyakov
alexey.sklad...@gmail.com wrote:
On 27 February 2013 12:01, Raphael Gaschignard dasur...@gmail.com wrote:
I think it might be impossible with type families. I don't think it's
Hi Aleksey,
Unfortunately, your solution does not work for me (ghc 7.6.2). I reduced
the problem to:
-- | Type class for type equality.
class TypeEq (a :: α) (b :: α) (eq :: Bool) | a b - eq
instance TypeEq a a True
-- instance TypeEq a b False
instance eq ~ False = TypeEq a b eq
On 27.02.2013 17:35, Dmitry Kulagin wrote:
Hi Aleksey,
Unfortunately, your solution does not work for me (ghc 7.6.2). I reduced
the problem to:
-- | Type class for type equality.
class TypeEq (a :: α) (b :: α) (eq :: Bool) | a b - eq
instance TypeEq a a True
-- instance TypeEq a
Oh, that is my fault - I was sure that I specified the extension and it
didn't help.
It really works with OverlappingUndecidable.
Thank you!
On Wed, Feb 27, 2013 at 10:36 PM, Aleksey Khudyakov
alexey.sklad...@gmail.com wrote:
On 27.02.2013 17:35, Dmitry Kulagin wrote:
Hi Aleksey,
Hi,
I try to implement typed C-like structures in my little dsl.
I was able to express structures using type-level naturals (type Ty is
promoted):
data Ty = TInt | TBool | TStruct Symbol [Ty]
That allowed to implement all needed functions, including type-level
function:
type family Get (n ::
On 13-01-07 12:12 AM, Thomas Hartman wrote:
I have a space leak in a function that increments a number inside
IORef or STRef (either lazy or strict).
IORef and STRef operations do not automatically evaluate contents.
writeIORef r (x + 1) simply stores a pointer to the expression (thunk)
x +
I have had issues like this with modifySTRef before. Try to make a strict
version modifySTRef'
If memory serves, something like this worked for me.
modifySTRef' r f =
do
a - readSTRef r
writeSTRef r $! f a
___
Haskell-Cafe mailing list
A similar use-case and same solution with IORefs:
http://hpaste.org/diff/80055/80058 Guess which one threw a
stackoverflow and which one ran indefinitely when given a few hundred
million lines of input.
On 7 January 2013 07:35, Albert Y. C. Lai tre...@vex.net wrote:
On 13-01-07 12:12 AM, Thomas
Here it is
:http://shootout.alioth.debian.org/u64/program.php?test=fannkuchreduxlang=ghcid=4
Date: Mon, 3 Dec 2012 15:32:20 -0800
Subject: Re: [Haskell-cafe] Help optimize fannkuch program
From: b...@serpentine.com
To: bm...@hotmail.com
CC: haskell-cafe@haskell.org
On Mon, Dec 3, 2012 at 11:18
On Sun, Dec 2, 2012 at 3:12 PM, Branimir Maksimovic bm...@hotmail.comwrote:
Well, playing with Haskell I have literally trasnlated my c++ program
http://shootout.alioth.debian.org/u64q/program.php?test=fannkuchreduxlang=gppid=3
and got decent performance but not that good in comparison
with
mine version.Thanks ! Should I contribute your version on shootout site?
Date: Mon, 3 Dec 2012 00:01:32 -0800
Subject: Re: [Haskell-cafe] Help optimize fannkuch program
From: b...@serpentine.com
To: bm...@hotmail.com
CC: haskell-cafe@haskell.org
On Sun, Dec 2, 2012 at 3:12 PM, Branimir Maksimovic bm
On Mon, Dec 3, 2012 at 11:18 AM, Branimir Maksimovic bm...@hotmail.comwrote:
Thanks ! Should I contribute your version on shootout site?
Do whatever you like with it.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Well, playing with Haskell I have literally trasnlated my c++ program
http://shootout.alioth.debian.org/u64q/program.php?test=fannkuchreduxlang=gppid=3and
got decent performance but not that good in comparisonwith c++ On my machine
Haskell runs 52 secs while c++ 30 secs.(There is Haskell entry
Hey,
So, I couldn't really get a small code sample.
But I have a new example of the same problem.
Anyway, let me just give you the overall picture.
I am building an interpreter and I want to evaluate
the definition of a recursive function. This entails
registering the function symbol in the
Hey everyone,
I changed my code I now I get the following error message
Main: thread blocked indefinitely in an MVar operation
Before the change, I was using the State monad with runState.
Then, I changed the code to use the StateT monad transformer wrapped
around IO monad and runStateT.
On Tue, Oct 23, 2012 at 5:03 PM, José A. Lopes jose.lo...@ist.utl.pt wrote:
Hey everyone,
I changed my code I now I get the following error message
Main: thread blocked indefinitely in an MVar operation
Before the change, I was using the State monad with runState.
Then, I changed the
Hello. I am trying to write some thing in haskell and i need fast
storage to store and select this things from storage.
https://github.com/s9gf4ult/projs/tree/master/haskell/teststorage
I am writing simple testing package to determine my needs and select
the fastest storage and i have encountered
Hi everyone,
If this mail sound strange to you, you are free to ignore it.
My name is Alfredo Di Napoli and I'm a 24-year-old programmer from
Rome, Italy. I've graduated in May and I'm currently working as an intern
for a company involved in the defence field.
In my spare time, though, I study
Hi Alfredo,
You might look at the various bigdata companies. I was surprised by
how many of them are using Scala or Clojure - it's definitely over
50%. Looks like FP is really gaining traction in this area.
On Wed, Sep 12, 2012 at 11:48 AM, Alfredo Di Napoli
alfredo.dinap...@gmail.com wrote:
Hi
Hi all,
I'm just about ready to make the 0.5 release of conduit. And as usual,
I'm running up against the hardest thing in programming: naming
things.
Here's the crux of the matter: in older versions of conduit, functions
would have a type signature of Source, Sink, or Conduit. For example:
On Thu, Jun 28, 2012 at 6:11 PM, Michael Snoyman mich...@snoyman.com wrote:
Hi all,
I'm just about ready to make the 0.5 release of conduit. And as usual,
I'm running up against the hardest thing in programming: naming
things.
Here's the crux of the matter: in older versions of conduit,
On Thu, Jun 28, 2012 at 8:36 PM, Paolo Capriotti p.caprio...@gmail.com wrote:
On Thu, Jun 28, 2012 at 6:11 PM, Michael Snoyman mich...@snoyman.com wrote:
Hi all,
I'm just about ready to make the 0.5 release of conduit. And as usual,
I'm running up against the hardest thing in programming:
Can I really rename old.T = new.T_orig ?
It looks as if then tries to load the wrong acid-state snapshot.
The name of your data type doesn't matter as acid-state doesn't store
that on the disk.
I think it does - because file names are state/T/*.log and so on?
J.W.
On Tue, Jan 31, 2012 at 8:27 AM, Johannes Waldmann
waldm...@imn.htwk-leipzig.de wrote:
Can I really rename old.T = new.T_orig ?
It looks as if then tries to load the wrong acid-state snapshot.
The name of your data type doesn't matter as acid-state doesn't store
that on the disk.
I
Felipe Almeida Lessa felipe.lessa at gmail.com writes:
data T_orig = T_orig Foo
$(deriveSafeCopy 0 'base ''T_orig)
data T = T Foo Bar
$(deriveSafeCopy 0 'extension ''T)
instance Migrate T where type MigrateFrom T = T_Orig ...
As you can read from deriveSafeCopy's documentation [1],
On Mon, Jan 30, 2012 at 4:46 PM, Johannes Waldmann
waldm...@imn.htwk-leipzig.de wrote:
Thanks - which zero? (there are two of them.)
You should not change the deriveSafeCopy of your old data type. The
only allowed change is renaming your data type (see below). You
should increment the version
Dear all,
I can't quite get safecopy to work with acid-state:
old version of code :
data T = T Foo
$(deriveSafeCopy 0 'base ''T)
new version :
data T_orig = T_orig Foo
$(deriveSafeCopy 0 'base ''T_orig)
data T = T Foo Bar
$(deriveSafeCopy 0 'extension ''T)
instance Migrate T where type
On Fri, Jan 27, 2012 at 3:04 PM, Johannes Waldmann
waldm...@imn.htwk-leipzig.de wrote:
data T_orig = T_orig Foo
$(deriveSafeCopy 0 'base ''T_orig)
data T = T Foo Bar
$(deriveSafeCopy 0 'extension ''T)
instance Migrate T where type MigrateFrom T = T_Orig ...
As you can read from
On 09.08.2011 01:43, Thiago Negri wrote:
Hello all,
I'm relatively new to Haskell and trying to solve some online judge's
problems in it.
One of the problems is to say if a given sentence is a tautogram or not.
A tautogram is just a sentence with all the words starting with the same letter.
My
So, thanks to Henning Thielemann I was able to make a code a little
more functional.
I did find ByteString module that really speed things up.
I got 0.04 seconds with the following snippet:
-- code start
import qualified Data.ByteString.Char8 as BS
import Data.Char (toLower)
main :: IO ()
main
Hello all,
I'm relatively new to Haskell and trying to solve some online judge's
problems in it.
One of the problems is to say if a given sentence is a tautogram or not.
A tautogram is just a sentence with all the words starting with the same letter.
My first try (solution is ok) was to do it as
Yes, how can i miss that...
It's working now, but still it works only for the first element of the
list. It prints the result only for the first string. Now when it's
operational, i have just to modify it to be working for all of the
elements of the list.
If i run the program right now, the
so think about the high level design for a second, and let that guide the
types. then the types should guide the code.
p, which I assume is the top level evaluation, is supposed to take a list of
strings, and produce a list of integers (the result of evaluating the
expression), right? So it
Yeah, that really helped me :))
Finally i got the results i wanted :
Main p [2*34/3,2+3,2*(6/2)]
[22,5,6]
There is only one more question i have about this. I have already
written 2 error captures, but they don't really apply to the task i
have. Here are my error captures:
Well, if you are at all familiar with (or wanted to learn about) the Maybe
type, I would suggest you use that. A brief synopsis:
data Maybe a = Nothing | Just a
Which means that a Maybe Int is either Nothing or or Just an int.
If you were to got this path, then your p function should have
First I am using WinHugs.
that's the code i made so far but it's still not working:
http://hpaste.org/48318
Error:
ERROR file:.\kursovazadacha.hs:36 - Type error in explicitly typed binding
*** Term : p
*** Type : [String] - [a]
*** Does not match : [String] - Int
I'm
The error in ghci is
Couldn't match expected type `Int' with actual type `[a0]'
In the expression: []
In an equation for `p': p [] = []
You've defined p as [String] - Int, but then your base case is p [] = []. []
is not an Int. I changed it to 0 and it'll compile, at least, but I'm not
Hello all,
I am experiencing some issues to do my course task in university.
I have to write a calculator- function in Haskell. The function
argument is a list of strings and also form such list, as each string
of the argument made definite action:
- If the string has the form of an arithmetic
What have you tried to do in order to make it work for the list, and what error
results? What is confusing about the error message? More generally, how could
you transform an operation on a single string into one that does the same thing
to a list of strings? You've probably talked about higher
I found the library myself, and i already put the code in that site:
http://hpaste.org/48277
That's what i have tried to do for making the task by calling the one
string function by another one:
include kursovazadacha
parse :: [a] - [a]
parse [] = []
parse (x:xs) = eval (x:xs)
The error
what haskell compiler are you using? And what does the include line do?
That does not look like a GHC error message (the only compiler I'm familiar
with), but it seems like it is saying that you should not have the extra
newlines between the function type signature and declaration. - that's
On Fri, Mar 25, 2011 at 9:52 PM, Bernie Pope florbit...@gmail.com wrote:
On 26 March 2011 05:57, Rob Nikander rob.nikan...@gmail.com wrote:
\begin{comment}
-- A work-around for Dynamics. The keys used to compare two TypeReps are
-- somehow not equal for the same type in hs-plugin's loaded
Hi all,
I'm trying to use the 'plugins' package. Since I already posted to
stackoverflow I'll just link to that. I posted a simple program that
I thought would work, but mostly doesn't. Any pointers, appreciated.
On 26 March 2011 05:57, Rob Nikander rob.nikan...@gmail.com wrote:
I'm trying to use the 'plugins' package. Since I already posted to
stackoverflow I'll just link to that. I posted a simple program that
I thought would work, but mostly doesn't. Any pointers, appreciated.
On 22 March 2011 15:49, Jason Dagit dag...@gmail.com wrote:
This seems to consistently give about a 0.4s improvement, which isn't
nothing but isn't a particularly interesting chunck of 8s (actually
it's 8.4s - 8s). Setting it to 256M doesn't make any difference.
You should use criterion to
On 22 March 2011 02:00, Jesper Louis Andersen
jesper.louis.ander...@gmail.com wrote:
On Tue, Mar 22, 2011 at 00:59, David MacIver da...@drmaciver.com wrote:
It's for rank aggregation - taking a bunch of partial rankings of some
items from users and turning them into an overall ranking (aka
On Tue, Mar 22, 2011 at 09:11, David MacIver da...@drmaciver.com wrote:
Productivity 85.0% of total user, 85.0% of total elapsed
That is somewhat ok. So much for hoping GC tuning would yield an improvement.
--
J.
___
Haskell-Cafe mailing list
On Tue, Mar 22, 2011 at 1:11 AM, David MacIver da...@drmaciver.com wrote:
On 22 March 2011 02:00, Jesper Louis Andersen
jesper.louis.ander...@gmail.com wrote:
On Tue, Mar 22, 2011 at 00:59, David MacIver da...@drmaciver.com
wrote:
It's for rank aggregation - taking a bunch of partial
Hi,
I have a Haskell program I'm trying to optimise, and could use some assistance.
It's for rank aggregation - taking a bunch of partial rankings of some
items from users and turning them into an overall ranking (aka That
thing that Hammer Principle does).
The code is here:
On Tue, Mar 22, 2011 at 00:59, David MacIver da...@drmaciver.com wrote:
It's for rank aggregation - taking a bunch of partial rankings of some
items from users and turning them into an overall ranking (aka That
thing that Hammer Principle does).
Two questions immediately begs themselves:
*
You use a lot of (linked lists). Are they all used to represent streams or
are they actually manifest during runtime? If it's the latter switch to a
better data structure, like Vector.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Yeah, that works! Thanks!
--
View this message in context:
http://haskell.1045720.n5.nabble.com/Help-with-how-to-concatenate-with-own-datatypes-tp3424433p3425325.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
___
Hi,
I´m doing a project in haskell and I need to define an operator that
concatenate some own defined data types, just like the operator ++ does for
lists. I don´t see how to define the operator recursively since this adding
function (:) doesn´t work on my own data types.
This is my code:
data
On Thu, Mar 10, 2011 at 7:41 PM, eldavido eldavi...@hotmail.com wrote:
Hi,
I´m doing a project in haskell and I need to define an operator that
concatenate some own defined data types, just like the operator ++ does for
lists. I don´t see how to define the operator recursively since this
Just write a loop:
let loop gs gu
| Just z - find_obj gu usyms = do
...
(gs', gu') - handle_obj_ar ...
loop gs' gu'
| otherwise = return (gs,gu)
(gs, gu) - loop def undef
mfix is for when you have mutually recursive data but you want the IO
operation
hello cafe,
I just want to do cursion to a fixpoint in an IO function, I write sth.
like this,
handle_ar::(Set String,Set String)-FilePath- IO (Set String, Set String)
handle_ar (def,undef) ar=do
let gs = def
gu = undef
syms - liftM (map (\x - (symb x, x))) $ defined_syms ar
usyms
On Tue, 8 Feb 2011, C K Kashyap wrote:
I need to convert IOArray to bytestring as shown below -
import Data.Array.IO
import Data.Binary.Put
import qualified Data.ByteString.Lazy as BS
import Data.Word
main = do
arr - newArray (0,9) 0 :: IO (IOArray Int Int)
let bs=toByteString arr
return ()
Hi,
I need to convert IOArray to bytestring as shown below -
import Data.Array.IO
import Data.Binary.Put
import qualified Data.ByteString.Lazy as BS
import Data.Word
main = do
arr - newArray (0,9) 0 :: IO (IOArray Int Int)
let bs=toByteString arr
return ()
How can I implement the 'toByteString'
Your array contains machine-sized Ints, which in practice are likely
either 32-bit or 64-bit, while a ByteString is the equivalent of an
array or 8-bit values. So you'll need to somehow convert the Ints to
Word8s. Do you know if you need big or little endian?
A basic approach would be:
* Use
On Tue, Feb 8, 2011 at 2:26 PM, Michael Snoyman mich...@snoyman.com wrote:
Your array contains machine-sized Ints, which in practice are likely
either 32-bit or 64-bit, while a ByteString is the equivalent of an
array or 8-bit values. So you'll need to somehow convert the Ints to
Word8s. Do
On Tue, Feb 8, 2011 at 11:13 AM, C K Kashyap ckkash...@gmail.com wrote:
On Tue, Feb 8, 2011 at 2:26 PM, Michael Snoyman mich...@snoyman.com wrote:
Your array contains machine-sized Ints, which in practice are likely
either 32-bit or 64-bit, while a ByteString is the equivalent of an
array
1) Just use Data.Word.Word8 instead of the second Int in your type sig
for IOArray
2) Use getElems to get a [Word8]
3) Data.ByteString.pack converts a [Word8] into a ByteString
Michael
I am currently using a list of tuples - [(Int,Int,Int)] to represent an
image buffer. You can see it in
C K Kashyap ckkash...@gmail.com writes:
I am currently using a list of tuples - [(Int,Int,Int)] to represent an
image buffer.
[...]
Looks like this is pretty slow,
Unsurprisingly, as there's a huge space overhead, and (depending on
usage, but probably even worse) linear access time.
I
On Tue, Feb 8, 2011 at 10:39 AM, C K Kashyap ckkash...@gmail.com wrote:
1) Just use Data.Word.Word8 instead of the second Int in your type sig
for IOArray
2) Use getElems to get a [Word8]
3) Data.ByteString.pack converts a [Word8] into a ByteString
Michael
I am currently using a list of
Hello all, sorry I must have taken my stupid pills this morning, I cannot
get the following code to compile, what am I missing?
data MyState=MyState Integer
newState:: (RandomGen g) = RandT g IO MyState
newState = do
time-liftIO getCPUTime
rand-getRandomR (1,6)
return $
On Thursday 23 December 2010 15:52:40, JP Moresmau wrote:
Hello all, sorry I must have taken my stupid pills this morning, I
cannot get the following code to compile, what am I missing?
Works here.
Which versions of the packages and GHC are you using?
On Thursday 23 December 2010 15:52:40, JP Moresmau wrote:
what am I missing?
Maybe I just spotted it:
But the MonadRandom docs say:
Instances:
MonadIOhttp://hackage.haskell.org/packages/archive/transformers/0.2.2.0/doc/html/Control-
Monad-IO-Class.html#t:MonadIO m
links to the
GHC 6.12.1, base 4.2.0.0, MonadRandom-0.1.6, transformers-0..2.2.0, on
Windows.Could it be that my system is not picking up the MonadIO I think it
does?
JP
On Thu, Dec 23, 2010 at 4:13 PM, Daniel Fischer
daniel.is.fisc...@googlemail.com wrote:
On Thursday 23 December 2010 15:52:40, JP
On Thursday 23 December 2010 16:21:05, JP Moresmau wrote:
GHC 6.12.1, base 4.2.0.0, MonadRandom-0.1.6, transformers-0..2.2.0, on
Windows.
Could it be that my system is not picking up the MonadIO I think it does?
Probably. With 6.12.1, you'll probably have an mtl-1.* installed, so the
Thanks a million, it worked! Following all the dependencies sometimes is a
bit of a headache. But in a sense, I'm happy to see I had understood how to
use the monad transformer correctly, it wasn't me being (too) stupid. Thanks
again!
JP
On Thu, Dec 23, 2010 at 4:32 PM, Daniel Fischer
Hi, I wonder if someone could point out what I am doing wrong. My
understanding was that I should be able to create a .lhs file and run it
e.g. with ghci and then use lhs2TeX to create a nice .pdf file, all from
the same source. I can produce nice slides but unfortunately the .lhs
does compile
Hi Dominic,
Hi, I wonder if someone could point out what I am doing wrong. My
understanding was that I should be able to create a .lhs file and run it
e.g. with ghci and then use lhs2TeX to create a nice .pdf file, all from
the same source. I can produce nice slides but unfortunately the .lhs
the basic approach (originally) is to have an executable Haskell program
so that you can typecheck it. Then you add some %format directives to make
it look nice, eg.
%format Mu f = \mu f
%format in_ = in^\circ
should do the job.
Hth, Ralf
It certainly does. Obvious really (as are
On Mon, Dec 6, 2010 at 11:53 PM, Luke Palmer lrpal...@gmail.com wrote:
This has nothing to do with a monad. This is just about data. You
want a type that can contain any Typeable type, and a safe way to cast
out of that type into the type that came in. Such a thing exists,
it's called
Hi all,
I gave myself until this evening to figure this out on my own, and
time is up! Hopefully this makes for a good discussion, though the
idea could be dumb.
What I'm trying to do is define a state monad in which the passed
state can change type during the computation. The only constraint is
This has nothing to do with a monad. This is just about data. You
want a type that can contain any Typeable type, and a safe way to cast
out of that type into the type that came in. Such a thing exists,
it's called Data.Dynamic.
Then your monad is just StateT Dynamic, where your magical
2010/10/27 Andy Stewart lazycat.mana...@gmail.com:
Hi all,
I want use TH write some function like below:
data DataType = StringT
| IntT
| CharT
parse :: [(String,DataType)] - (TypeA, TypeB, ... TypeN)
Example:
parse [(string, StringT), (001, IntT), (c,
Serguey Zefirov sergu...@gmail.com writes:
2010/10/27 Andy Stewart lazycat.mana...@gmail.com:
Hi all,
I want use TH write some function like below:
data DataType = StringT
| IntT
| CharT
parse :: [(String,DataType)] - (TypeA, TypeB, ... TypeN)
Example:
Unless you have a 'real' type for parse sometime during compile time, TH
won't be able to generate it. A good rule of thumbs is that if you can't
write the code yourself, then you can't get TH to do it either.
/J
On 27 October 2010 08:50, Andy Stewart lazycat.mana...@gmail.com wrote:
Serguey
2010/10/27 Andy Stewart lazycat.mana...@gmail.com:
Serguey Zefirov sergu...@gmail.com writes:
I think that you should use TH properly, without compiler and logical errors.
What actually do you want?
I'm build multi-processes communication program.
You don't need TH here, I think.
You can
Hi all,
I want use TH write some function like below:
data DataType = StringT
| IntT
| CharT
parse :: [(String,DataType)] - (TypeA, TypeB, ... TypeN)
Example:
parse [(string, StringT), (001, IntT), (c, CharT)]
will return:
(string, 001, 'c')
So how
I am Studying for an exam, and i have just come accross the following 3
questions, i am not familiar with the functions, therefore i would appreciate
any help.
!! i have already created painting 2 3 all i need is the 3 functions, for the
three different tasks as shown below. the functions are
I'm not sure what you're asking for; it looks like you have to
implement the functions from the specifications.
On Thu, Oct 21, 2010 at 6:11 PM, Yaadallah Khan yk...@hotmail.com wrote:
I am Studying for an exam, and i have just come accross the following 3
questions, i am not familiar with the
S. Doaitse Swierstra schrieb:
Avoiding repeated additions:
movingAverage :: Int - [Float] - [Float]
movingAverage n l = runSums (sum . take n $l) l (drop n l)
where n' = fromIntegral n
runSums sum (h:hs) (t:ts) = sum / n' : runSums (sum-h+t) hs ts
runSums _
On 29 sep 2010, at 00:58, o...@cs.otago.ac.nz wrote:
Avoiding repeated additions:
movingAverage :: Int - [Float] - [Float]
movingAverage n l = runSums (sum . take n $l) l (drop n l)
where n' = fromIntegral n
runSums sum (h:hs) (t:ts) = sum / n' : runSums (sum-h+t) hs ts
Avoiding repeated additions:
movingAverage :: Int - [Float] - [Float]
movingAverage n l = runSums (sum . take n $l) l (drop n l)
where n' = fromIntegral n
runSums sum (h:hs) (t:ts) = sum / n' : runSums (sum-h+t) hs ts
runSums _ _ [] = []
Doaitse
On 28
Hi all,
We have add many APIs in gtk2hs darcs, and ready to release
gtk2hs-0.12.0
Please help us test gtk2hs darcs, we can fix it before release
gtk2hs-0.12.0
You can get gtk2hs darcs with below command:
darcs get code.haskell.org/gtk2hs
Please send any bug report to
On 27/09/2010, at 5:20 AM, rgowka1 wrote:
Type signature would be Int - [Double] - [(Double,Double)]
Any thoughts or ideas on how to calculate a n-element moving average
of a list of Doubles?
Let's say [1..10]::[Double]
what is the function to calculate the average of the 3 elements?
Type signature would be Int - [Double] - [(Double,Double)]
Any thoughts or ideas on how to calculate a n-element moving average
of a list of Doubles?
Let's say [1..10]::[Double]
what is the function to calculate the average of the 3 elements?
[(1,0),(2,0),(3,2),(4,3)] :: [(Double,Double)]
2010/9/26 rgowka1 rgow...@gmail.com:
Type signature would be Int - [Double] - [(Double,Double)]
Any thoughts or ideas on how to calculate a n-element moving average
of a list of Doubles?
Let's say [1..10]::[Double]
what is the function to calculate the average of the 3 elements?
Hi Dan,
This presentation is really nice.
I went over it a couple of times and I think this ppt will help me try
to use Haskell for things that I usually use Perl for :)
A quick question - import Process bombs on my GHCI(The Glorious
Glasgow Haskell Compilation System, version 6.12.3) -what do I
That's a separate module, based on System.Process --
http://code.haskell.org/~dons/code/cpuperf/Process.hs
ckkashyap:
Hi Dan,
This presentation is really nice.
I went over it a couple of times and I think this ppt will help me try
to use Haskell for things that I usually use Perl for :)
1 - 100 of 393 matches
Mail list logo