On Tue, Dec 29, 2009 at 11:52 PM, Jason Dusek jason.du...@gmail.com wrote:
HPath is a command line utility to grab the Haskell source
for a given identifier:
:; dist/build/hpath/hpath HPath.Path.parse 2/dev/null
parse :: String - Either ParseError Path
parse s =
Daniel Fischer daniel.is.fischer at web.de writes:
Am Mittwoch 30 Dezember 2009 01:04:34 schrieb Will Ness:
While I haven't detected that with the primes code, I find that in my
ghci your code is approximately 2.5 times faster than ONeill or Bayer
when interpreted (no difference
Daniel Fischer daniel.is.fischer at web.de writes:
No, it's my own code. Nothing elaborate, just sieving numbers 6k±1, twice as
fast as the haskellwiki code (here) and uses only 1/3 the memory. For the
record:
.
thanks! will need to sift through it thoroughly... :) :)
BTW I
Am Dienstag 29 Dezember 2009 20:16:59 schrieb Daniel Fischer:
especially the claim that going by primes squares
is a pleasing but minor optimization,
Which it is not. It is a major optimisation. It reduces the algorithmic
complexity *and* reduces the constant factors significantly.
D'oh!
Why fact2 is quicker than fact?!
fact2 :: Integer - Integer
fact2 x = f x y
where
f n e | n 2 = 1
| e == 0 = n * (n - 1)
| e 0 = (f n (e `div` 2)) * (f (n - (e * 2)) (e `div` 2))
y = 2 ^ (truncate (log (fromInteger x) / log 2))
fact :: Integer - Integer
fact 1 = 1
fact n = n * fact (n - 1)
I
Günther Schmidt wrote:
Hi guys,
any suggestions on how to go about it then?
I'm really still no step further on the DSL for Relational Algebra
thingy, and I'd even settle for a comprehension DSL.
I've spent months now, trying to figure it out by myself, studying
HaskellDB, HList and
fact2 is O(log n) while fact is O(n).
fact2 is partitioning the problem.
On Wed, Dec 30, 2009 at 08:57, Artyom Kazak artyom.ka...@gmail.com wrote:
Why fact2 is quicker than fact?!
fact2 :: Integer - Integer
fact2 x = f x y
where
f n e | n 2 = 1
| e == 0 = n * (n - 1)
| e 0 = (f n (e
fact2 is O(log n) while fact is O(n).
fact2 is partitioning the problem.
But fact2 sparks off two recursive calls. If we assume that
multiplication is a constant-time operations, both algorithms
have the same asymptotic running time (try a version that
operates on Ints). For Integers, this
fact2 sparks 2*n multiplications for every (n^2) factors
fact sparks n multiplications for every n factors
On Wed, Dec 30, 2009 at 10:13, Ralf Hinze ralf.hi...@comlab.ox.ac.ukwrote:
fact2 is O(log n) while fact is O(n).
fact2 is partitioning the problem.
But fact2 sparks off two
fact2 sparks 2*n multiplications for every (n^2) factors
fact sparks n multiplications for every n factors
Okay, let's count:
data Tree a = Leaf a | Fork (Tree a) (Tree a)
deriving (Show)
fact 1 = Leaf 1
fact n = Leaf n `Fork` fact (n - 1)
fact2 x = f x y
where
f n e | n 2 =
I can't offer much insight but could the answer lie in the Integer
type? I suspect that with a sufficiently large fixed Int type (2^14
bits?) the performance of the two functions would be almost equal.
Could it be that the second function delays the multiplication of
large numbers as long as
Am Mittwoch 30 Dezember 2009 11:57:28 schrieb Artyom Kazak:
Why fact2 is quicker than fact?!
fact2 :: Integer - Integer
fact2 x = f x y
where
f n e | n 2 = 1
| e == 0 = n * (n - 1)
| e 0 = (f n (e `div` 2)) * (f (n - (e * 2)) (e `div` 2))
y = 2 ^ (truncate (log (fromInteger x) / log
Am Mittwoch 30 Dezember 2009 17:28:37 schrieb Roel van Dijk:
I can't offer much insight but could the answer lie in the Integer
type? I suspect that with a sufficiently large fixed Int type (2^14
bits?) the performance of the two functions would be almost equal.
For fact (10^6), we'd need
As an aside, in one of my libraries I have a combinator
for folding a list in a binary-subdivision scheme.
foldm :: (a - a - a) - a - [a] - a
foldm (*) e x
| null x= e
| otherwise = fst (rec (length x) x)
where rec 1 (a :
Yes, I just saw that.
http://hackage.haskell.org/package/HPath-0.0.1
It doesn't handle Haskell needing the C preprocessor and
there are some real problems with the output of data/type
definitions -- I hope to resolve these shortly.
--
Jason Dusek
On Wed, Dec 30, 2009 at 10:35 AM, Ralf Hinze ralf.hi...@comlab.ox.ac.uk wrote:
As an aside, in one of my libraries I have a combinator
for folding a list in a binary-subdivision scheme.
foldm :: (a - a - a) - a - [a] - a
I would use:
foldm :: Monoid m = [m] - m
Which
I would use:
foldm :: Monoid m = [m] - m
Which is just a better implementation of mconcat / fold. The reason I
prefer this interface is that foldm has a precondition in order to
have a simple semantics: the operator you're giving it has to be
associative. I like to use typeclasses to
On Wed, Dec 30, 2009 at 11:15 AM, Ralf Hinze ralf.hi...@comlab.ox.ac.uk wrote:
I would use:
foldm :: Monoid m = [m] - m
Which is just a better implementation of mconcat / fold. The reason I
prefer this interface is that foldm has a precondition in order to
have a simple semantics: the
Daniel Fischer daniel.is.fischer at web.de writes:
Am Dienstag 29 Dezember 2009 20:16:59 schrieb Daniel Fischer:
especially the claim that going by primes squares
is a pleasing but minor optimization,
Which it is not. It is a major optimisation. It reduces the algorithmic
Hi
A function inc5
inc5 :: Float - Float
inc5 x = x + 5
can only be a member of a type class A, if we make all functions from
Float - Float members of type class A. Thus, I assume, that _type_
class is named type class, as membership is decided by types.
However, it makes no sense to say
Say I have something like
data DT a = Foo a | Bar a | Boo a
I want something like a list of the constructors of DT, perhaps as [TypeRep].
I'm using Data.Typeable but can't seem to find what I need in there.
Everything there operates over constructors, not types.
On Wed, Dec 30, 2009 at 1:12 PM, Mads Lindstrøm
mads_lindstr...@yahoo.dk wrote:
This idea, of value classes, do not feel all that novel. Somebody has
properly thought about it before, but gave it a different name. If
anybody has links to some papers it would be much appreciated. If
anybody has
Gregory Propf wrote:
Say I have something like
data DT a = Foo a | Bar a | Boo a
I want something like a list of the constructors of DT, perhaps as [TypeRep].
I'm using Data.Typeable but can't seem to find what I need in there.
Everything there operates over constructors, not types.
The
Here is a bug report for the newlines issue:
http://trac.haskell.org/haskell-src-exts/ticket/188
A tentative patch is also included. This is not something I can
really fix within HPath, unfortunately.
--
Jason Dusek
___
Haskell-Cafe mailing
I've put some of Oleg's code on hackage, named polytypeable.
import Data.PolyTypeable
main = print [polyTypeOf Nothing, polyTypeOf Just]
This prints
[Maybe a1,a1 - Maybe a1]
To get a list of the actual constructors you need to derive
Data.Data.Data and use that.
-- Lennart
On Wed, Dec
Hello Justin,
since you are about to migrate HaskellDB to using HList, do we still
need singleton types for the columns as before?
Günther
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
I love lambda's:
http://hawtness.com/2009/12/30/wtf-girl-photo-more-reasons-why-half-life-is-awesome/
--
Regards,
Henk-Jan van Tuyl
--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
___
Haskell-Cafe mailing list
Am Mittwoch 30 Dezember 2009 20:46:57 schrieb Will Ness:
Daniel Fischer daniel.is.fischer at web.de writes:
Am Dienstag 29 Dezember 2009 20:16:59 schrieb Daniel Fischer:
especially the claim that going by primes squares
is a pleasing but minor optimization,
Which it is not. It is
Hello all,
I am currently playing with the new cadre of failure libraries, and I'm
trying to figure out how to use the monadic version of Failure while
also getting the Try typeclass, which appears to be the standardized mechanism
for marshalling values from specific monads into the failure
Hello Cafe,
I've uploaded a new version of TxtSushi to
http://hackage.haskell.org/package/txt-sushi and announced the details
here http://blog.keithsheppard.name/2009/12/txtsushi-050.html.
TxtSushi is a set of command-line utilities for transforming CSV and
tab-delimited files including an SQL
On Wed, 2009-12-30 at 11:09 -0500, haskell-cafe-requ...@haskell.org
wrote:
Am Mittwoch 30 Dezember 2009 01:23:32 schrieb Will Ness:
Daniel Fischer daniel.is.fischer at web.de writes:
No, it's my own code. Nothing elaborate, just sieving numbers 6k1,
twice as fast as the
haskellwiki
I'm a Haskell neophyte, so may be missing something obvious in the
problem outlined below. I'm fairly proficient in Python + have some
limited experience in OCaml and F#, so know just enough to be be
dangerous, but not nearly enough to really know what I'm doing here.
OK, I have text files
On Wed, Dec 30, 2009 at 8:39 PM, Peter Green kinch1...@me.com wrote:
I'm a Haskell neophyte, so may be missing something obvious in the problem
outlined below. I'm fairly proficient in Python + have some limited
experience in OCaml and F#, so know just enough to be be dangerous, but not
nearly
On Wed, Dec 30, 2009 at 5:52 PM, Edward Z. Yang ezy...@mit.edu wrote:
Hello all,
I am currently playing with the new cadre of failure libraries, and I'm
trying to figure out how to use the monadic version of Failure while
also getting the Try typeclass, which appears to be the standardized
Excerpts from Alexander Dunlap's message of Thu Dec 31 00:06:58 -0500 2009:
Why are you importing both Control.Failure and Control.Monad.Failure
when the latter just re-exports the former? Are you using the latest
versions of the two packages? Try importing just
Control.Monad.Failure.MTL; that
Edward,
What version of the packages are you using? Can you give the output of:
ghc-pkg list|grep failure
Michael
On Thu, Dec 31, 2009 at 7:11 AM, Edward Z. Yang ezy...@mit.edu wrote:
Excerpts from Alexander Dunlap's message of Thu Dec 31 00:06:58 -0500 2009:
Why are you importing both
Excerpts from Michael Snoyman's message of Thu Dec 31 00:43:52 -0500 2009:
What version of the packages are you using? Can you give the output of:
ghc-pkg list|grep failure
Sure thing:
(control-monad-failure-0.4), (control-monad-failure-0.5.0),
control-monad-failure-mtl-0.5.0,
NSFW, by the way.
On Wed, Dec 30, 2009 at 5:15 PM, Henk-Jan van Tuyl hjgt...@chello.nl wrote:
I love lambda's:
--
Jeff Wheeler
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Wed, Dec 30, 2009 at 10:54 PM, Edward Z. Yang ezy...@mit.edu wrote:
Excerpts from Michael Snoyman's message of Thu Dec 31 00:43:52 -0500 2009:
What version of the packages are you using? Can you give the output of:
ghc-pkg list|grep failure
Sure thing:
(control-monad-failure-0.4),
39 matches
Mail list logo