G'day all.
Quoting Neil Mitchell <[EMAIL PROTECTED]>:
I don't believe that. I suspect the type system will mop these up.
As previously noted, anything involving undefined (thanks to seq) is
not equivalent.
While undefined is arguably uncommon, error most certainly isn't:
f1 (x:xs) = {-
G'day all.
Quoting Conal Elliott <[EMAIL PROTECTED]>:
That eta-expansion desugaring would lose sharing. Offhand, I don't know of
a desugaring that would do the trick and preserve sharing. Any ideas?
How about this?
f = let body = sort . nub
in \xs -> case xs of
[] -> [1]
G'day all.
Quoting Neil Mitchell <[EMAIL PROTECTED]>:
It's nice to write functions in point free style:
f = sort . nub
But sometimes I have to add an extra case, on a certain value:
f [] = [1]
f = sort . nub
But now these equations have different arities, and its rejected by
Haskell.
I do
G'day all.
Quoting Henning Thielemann <[EMAIL PROTECTED]>:
The rare cases occur for big numbers.
http://www.haskell.org/haskellwiki/Generic_number_type#isSquare
How big, you might ask?
Prelude> let dd = undefined :: Double in floatRadix dd ^ floatDigits dd
9007199254740992
Pretty big, and
G'day all.
Quoting Luke Palmer <[EMAIL PROTECTED]>:
What do you mean by "black hole" here?
A "black hole" is what happens when evalation of something recursively
depends on its own evaluation in such a way that no useful work can be
done. An example is:
let omega = omega + 1 in omega
I
G'day all.
Quoting [EMAIL PROTECTED]:
Perhaps another example is more relevant, the tradeoffs
space-time in the
"optimized" version of the powerset generator...
Yeah, I was going to bring up that topic.
I've been lazy programming for 15 or so years, and the only "bugs" that I
can think of ar
G'day all.
Quoting Achim Schneider <[EMAIL PROTECTED]>:
But you really need one with 5 differently-sized blades plus three
spezialized carving blades, an USB stick, microscope, 13 kinds of torx,
imbus etc drivers each, a tv set (analogue/digital) with unfoldable
touchscreen, at least 3-band GSM
G'day all.
Quoting Peter Verswyvelen <[EMAIL PROTECTED]>:
I actually meant something more like
http://en.wikipedia.org/wiki/Intentional_programming
I'm pretty sure that "Intentional programming" is Hungarian for "I want
to sell you another IDE".
Cheers,
Andrew Bromage
___
G'day all.
Quoting Yitzchak Gale <[EMAIL PROTECTED]>:
Data types consist only of computable elements. Since there
are only countably many computable functions, every data type
has at most countably many elements. In particular, it is a set.
I still say it "isn't a set" in the same way that a
G'day all.
Quoting David Menendez <[EMAIL PROTECTED]>:
data A = B
means that "B" constructs a value of type "A". The "=" acts more like the
"::=" in a BNF grammar.
And, indeed, that was the syntax for it in Miranda.
It is *not* a claim that A equals B, since A is a
type and B is a data
G'day all.
I think it was Ketil Malde who said:
If I understand correctly, a quantum computer might solve problems in
NP in polynomial time, which is assumed not to be possible for
deterministic computers.
Quoting Miguel Mitrofanov <[EMAIL PROTECTED]>:
No! Moreover, there is a hypothesis th
G'day all.
Quoting Wolfgang Jeltsch <[EMAIL PROTECTED]>:
I love my children. My laptop isn’t able to do that.
Neither am I, especially since I've never met them.
Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://
G'day all.
Tim Chevalier wrote:
The only thing that computers can do that humans can't is to work
without getting bored.
Quoting Bulat Ziganshin <[EMAIL PROTECTED]>:
ok, please compute 2^2^30 before continuing discussion. it seems that
you just use "i'm too bored" and "i can't" as synonyms.
G'day all.
Quoting alex <[EMAIL PROTECTED]>:
(Presumably you meant "instance Alg Sometype",
"instance Vec Sometype" etc.)
Yes, most likely. Obviously I didn't try to compile the code.
Now I know what they meant what they meant by "leave
your OO at the door".
To be fair, Haskell typeclass
G'day all.
Quoting alex <[EMAIL PROTECTED]>:
I would like to do this:
class Foo t where
hi :: t -> Bool
class Foo t => Bar t where
hi x = True
This is arguably one of the most requested features in Haskell. The only
reason why it hasn't been implemented yet is that
G'day all.
Quoting Achim Schneider <[EMAIL PROTECTED]>:
And if it wouldn't? After all, arguing that |N == |N is undefined
because it takes too long to check would earn you a straight F in any
math test.
That's only because you spelled it incorrectly for the purpose of
a maths test. Had you w
G'day all.
Quoting Jon Harrop <[EMAIL PROTECTED]>:
I would recommend adding:
1. FFT.
2. Graph traversal, e.g. "n"th-nearest neighbor.
I'd like to put in a request for Pseudoknot. Does anyone still have it?
Cheers,
Andrew Bromage
___
Haskell-Cafe
G'day all.
Quoting David Menendez <[EMAIL PROTECTED]>:
This is pretty much how I define Functor and Applicative instances for my
monads. It is admittedly irritating to have to write out the boilerplate,
but it doesn't seem irritating enough to require a language extension to
eliminate.
In th
G'day all.
On Mon, 2007-12-03 at 10:48 +0100, Ketil Malde wrote:
I find that I often need to add strictness when:
left thumb) parsing [Char] into something more compact, i.e. almost
all cases.
right thumb) storing data into maps, especially when the values
are produced by
G'day all.
I asked:
Actually, a more interesting problem is what you'd replace COBOL with,
and how you'd go about it. Wouldn't it be nice if there was a modern
language that you could write or rewrite new parts of your COBOL
application in, and it all worked seamlessly with what you already ha
G'day all.
Quoting [EMAIL PROTECTED]:
But... tell me please, ANYONE, who takes part in this inspiring
exchange: How many COBOL programs have you written in your life?
As you well know, only one COBOL program has ever been written. The
rest are just modifications of it.
Actually, a more inte
G'day all.
Quoting Felipe Lessa <[EMAIL PROTECTED]>:
But I can't say what was the particular method used by GHC.
I don't either, but here's a suggested plan of attack:
1. Write a parser for a suitable subset of Haskell, in a closely
related language (e.g. Miranda).
2. Write a front-end that
G'day all.
Quoting [EMAIL PROTECTED]:
== No, Gentlemen, nobody rational would use Taylor nowadays! It is
lousy.
This is correct. Real implementations are far more likely to use the
minmax polynomial of some order. However...
Then, a *rational* approximation gives you the same precision wi
G'day all.
I wrote:
However, this is still an O(log n) algorithm, because that's the
complexity of raising-to-the-power-of. And it's slower than the
simpler integer-only algorithms.
Quoting Henning Thielemann <[EMAIL PROTECTED]>:
You mean computing the matrix power of
/1 1\
\0 1/
?
I m
G'day all.
Quoting [EMAIL PROTECTED]:
zipWith (!!) (fix (([1]:).map(>>= \x->if x==0 then [1] else [1,0]))) [0..]
This was the shortest variant I could manage in the time allotted:
zipWith(!!)(fix(([1]:).map(>>= \x->1:[0|x==1])))[0..]
Cheers,
Andrew Bromage
__
G'day all.
Quoting [EMAIL PROTECTED]:
This nasty acquaintance of mine asked the students to write down a simple
procedure which generates the sequence after the infinite number of units
of time.
Cool problem! "Simple" is, of course, in the eye of the beholder.
zipWith (!!) (fix (([1]:).map(
G'day all.
Quoting [EMAIL PROTECTED]:
Andrew Bromage rebukes me once more that
the fl. point solution diverges
from the integer one [as if I didn't know that...],
Sorry if it came across as that. I just meant it as a segue into a way
to make the algorithm practical.
I do note that nobody ha
G'day all.
Quoting [EMAIL PROTECTED]:
There is one solution missing there (unless I skipped it) fib
n=((1+s)/2)^n-((1-s)/2)^n)/s where s=sqrt 5 If some of you complain
that this is real, not integer, please remember that
Leonardo of Pisa thought of applying this to rabbits. Well, rabbits are
no
G'day all.
Quoting Dan Weston <[EMAIL PROTECTED]>:
In any case, to answer your question more specifically, the memoization
of *constants*
I think you meant "CAFs".
You can just unroll the loop
yourself to see. The following runs as fast as you'd expect:
fib00 = 0
fib01 = 1
fib02 = fib00 +
G'day all.
Quoting Don Stewart <[EMAIL PROTECTED]>:
calculatePi total g = fromIntegral (4*count) / fromIntegral total
This is slightly more robust in cases where the multiplication would
overflow an Int:
calculatePi total g
= fromRational ((4*fromIntegral count) % fromIntegra
Quoting Justin Bailey <[EMAIL PROTECTED]>:
Done: http://www.haskell.org/haskellwiki/RuntimeCompilation . Please
update it as needed.
Thanks!
Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
G'day all.
Quoting Derek Elkins <[EMAIL PROTECTED]>:
Probably RuntimeCompilation (or something like that and linked from the
Knuth-Morris-Pratt implementation on HaWiki) written by Andrew Bromage.
I didn't keep a copy, but if someone wants to retrieve it from the Google
cache and put it on th
G'day all.
Quoting Don Stewart <[EMAIL PROTECTED]>:
That fits with my experience writing low level numeric code -- Integer
can be a killer.
Mind you, if you're intending to work with large integers or rationals,
Integer is great! The bottleneck is almost always "show".
Cheers,
Andrew Bromag
G'day.
Quoting Stefan O'Rear <[EMAIL PROTECTED]>:
All the MonadPlus I can think of (IO,Maybe,[]) satisfy it. Were you
thinking of right distribution?
No monad transformer can satisfy it, because lift m >> mzero is not mzero.
Cheers,
Andrew Bromage
___
G'day all.
Quoting Janis Voigtlaender <[EMAIL PROTECTED]>:
Yes. But actually what we would need would be that it checks as well
that we have implemented at *most* a minimal set of operations.
Otherwise, we are back to the point where I can implement both (==) and
(/=), and in a way that the sup
G'day all.
Quoting Janis Voigtlaender <[EMAIL PROTECTED]>:
Okay, it is quite natural to take this stand. But as you say, there is
no such commitment in the language definition. And even if there were, I
doubt it would be possible to enforce such invariants in a compiler. So
there would be "ille
G'day.
Quoting Janis Voigtlaender <[EMAIL PROTECTED]>:
Hmm, but I can easily define an instance of Eq that does not satisfy
this invariant. And I want the generated free theorem to be true for any
legal Haskell program.
I would think that if x == y isn't the same as not (x /= y) for some
type
[Ccing to haskell-cafe; please direct any replies there instead of haskell]
G'day all.
First of all, once again well done to Sascha on a great tool.
Just a few comments.
Quoting Janis Voigtlaender <[EMAIL PROTECTED]>:
- support for type classes
(e.g., enter "elem" and note the generated re
[Moved to haskell-cafe]
G'day all.
Quoting Don Stewart <[EMAIL PROTECTED]>:
You can't pattern match 'a' and 'a' like that -- there's no implicit
unification.
Since we're being nostalgic in other threads, this is #1 on my list of
things I miss from Miranda.
It's also high on my "things that
G'day all.
Quoting "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]>:
I would really like to see "category theory for the working
*non*mathematician".
It's pricey, but your local university library probably has it:
http://www.cambridge.org/catalogue/catalogue.asp?isbn=9780521478175
Cheers,
G'day all.
Quoting "Richard A. O'Keefe" <[EMAIL PROTECTED]>:
(5) Precisely because it seeks generality, category theory seems
difficult to "concrete thinkers". And books on category theory
tend to be extremely fast-paced, so ideas which are not in themselves
particularly esoteric (
G'day all.
Quoting [EMAIL PROTECTED]:
I have heard that a few times, not recently. This is really interesting,
WHAT do you actually miss?
Off the top of my head, from H1.4, I miss:
- MonadZero (a lot)
- Some of the monad/functor-overloaded functions (quite a bit)
- Record punning
G'day all.
Quoting [EMAIL PROTECTED]:
Or perhaps I am again completely wrong, as in the case of "R" not being
something I ever wanted?
This is off-topic, but the email address "r" at google.com is Rob Pike.
Only someone a similar stature (e.g. Richard O'Keefe) could get away
with that.
Cheer
G'day all.
Quoting Andrew Coppin <[EMAIL PROTECTED]>:
I tried to use Wikipedia to learn about how to build digital filters...
this was a disaster. There is almost no useful information there! :-(
That's not my experience. I didn't really understand Kalman filters
until I read the Wikipedia p
G'day all.
Vimal <[EMAIL PROTECTED]> quoted someone else as saying:
Monads in programming seem to be the most mysterious notion of the century.
I agree with the "hair shirt" talk on this. I found understanding monads
no harder than understanding objects, starting from a comparable level of
i
G'day all.
Quoting Derek Elkins <[EMAIL PROTECTED]>:
The first goal listed in the Haskell 1.0 Report is:
"It should be suitable for teaching, research, and applications,
including building large systems."
Haskell was never intended to be solely a teaching or research language.
(You didn't nec
G'day all.
Quoting PR Stanley <[EMAIL PROTECTED]>:
Fully lazy? Can you elaborate please?
Sure. that code again:
test1 = \n _ -> 1+n
test2 = \n -> let x = n+1 in \_ -> x
Suppose we have:
f g x = g x + g x
And we try two options:
f (test1 4) 3
f (test2 4) 3
In the fir
G'day all.
Quoting PR Stanley <[EMAIL PROTECTED]>:
\_ n -> 1 + n
\_ -> (\n -> 1 + n)
The outcome seems to be identical. is there a substantive difference
between the two definitions?
Certainly, GHC compiles these to the same code. But be careful! Consider
the following two defintions:
G'day all.
Quoting Chung-chieh Shan <[EMAIL PROTECTED]>:
Yes. You can even do this portably, using nothing "unsafe", with Dylan
Thurston's technique:
That paper gives you a choice between inefficient and leaky. I think I'll
take unsafeCoerce#. :-)
Cheers,
Andrew Bromage
___
G'day all.
Quoting Simon Peyton-Jones <[EMAIL PROTECTED]>:
| -- GHC rejects this. Hugs compiles it, but I can't call it as
| -- let ?foo = "Hello" in show Foo
| --
| -- Is there a good reason to disallow this?
| data Foo = Foo
|
| instance (?foo :: String) => Show Foo where
| showsPrec _ F
G'day all.
Slight nit...
Quoting ok <[EMAIL PROTECTED]>:
I've been thinking about making a data type an instance of MonadPlus.
From the Haddock documentation at haskell.org, I see that any such
instance should satisfy
mzero `mplus` x = x
x `mplus` mzero = x
mzero >>= f
G'day all.
Quoting Henning Thielemann <[EMAIL PROTECTED]>:
I join this minority. Lawyers, please turn a deaf ear.
I dissent in part.
Speaking for myself (I wrote quite a bit of stuff for hawiki, including
some of TyingTheKnot), I don't want anyone violating my copyrights.
However, I /did/ g
G'day all.
Quoting Hugh Perkins <[EMAIL PROTECTED]>:
Oh, I thought that I'd been an obvious C# fanboy for long enough that
I didnt need to mention it by name ;-)
Not everyone on haskell-cafe is stalking you, you know. :-)
Cheers,
Andrew Bromage
___
G'day all.
Quoting Hugh Perkins <[EMAIL PROTECTED]>:
However, using Swig etc to join Python to C++ takes a significant
amount of time, [...]
Supposedly, Boost.Python is pretty good.
Then I discovered a different language (not Haskell) that combined the
ease of Python with the speed of C++.
G'day all.
Quoting Bill Wood <[EMAIL PROTECTED]>:
As to whether Prolog is "dead" or not, it depends on your definition of
"dead". Three years ago (not ten!) I made my living maintaining and
developing a large application written in Prolog.
Back when I was doing logic programming, 10 or so ye
G'day all.
Quoting David Ritchie MacIver <[EMAIL PROTECTED]>:
I was playing with some code for compiling regular expressions to
finite state machines and I ran into the following problem. I've solved
it, but I'm not terribly happy with my solution and was wondering if
someone could come up with
G'day all.
Quoting Andrew Coppin <[EMAIL PROTECTED]>:
So many other programming languages allow weird things to happen with
numeric overflows... it would be nice if Haskell didn't.
It would nice if CPUs supported trapping integer arithmetic.
Cheers,
Andrew Bromage
___
G'day all.
Quoting Jon Harrop <[EMAIL PROTECTED]>:
> Does anyone have any Haskell code implementing suffix trees? I'm particularly
> interested in high-performance construction.
No, but I have this:
http://citeseer.ist.psu.edu/giegerich95comparison.html
First person to implement them gets
{-# OPTIONS -fglasgow-exts #-}
-- G'day everyone.
-- This is okay.
f1 :: (?foo :: String) => String
f1 = ?foo
-- So is this.
f2 :: (Show a, ?foo :: a) => a -> String
f2 _ = show ?foo
-- Hugs allows this. GHC rejects it on the grounds that "a" is unused
-- on the right-hand side of the (=>). I
G'day all.
Quoting Stefan O'Rear <[EMAIL PROTECTED]>:
> In general, GHC doesn't do "unboxing". Instead it has a simpler and
> more general approach, [...]
I'm not convinced that the phrase "more general" is appropriate here. :-)
> As far as actual heap usage goes, GHC creates single static val
G'day.
Quoting Andrew Coppin <[EMAIL PROTECTED]>:
> First of all, currently I'm just using Double to represent coordinates.
> Can anybody tell me what the smallest value you can represent with one
> is? (Not including denormals.)
Remember that floating point numbers are stored in three parts. T
G'day all.
Quoting Vimal <[EMAIL PROTECTED]>:
> Well, Dancing Links (DLX) is just a data structure + few techniques
> to help with the backtrack, after modeling Sudoku as a contraint
> satisfaction problem.
DLX is one realisation of an algorithm which works on boolean matrices.
It's a pointer-b
G'day all.
Quoting ChrisK <[EMAIL PROTECTED]>:
> My optimized (and fixed) version of the code is attached.
By the way. I don't know if this is relevant, but I'm curious if this
approach is any faster:
http://72.14.253.104/search?q=cache:kG4zvvkZPLYJ:www.haskell.org/hawiki/RunTimeCompilation
I
G'day.
Quoting Bulat Ziganshin <[EMAIL PROTECTED]>:
> and why you stopped at 0.5?
I left that job.
Interestingly, I still own the IP on it, apart from some trade
secret (namely the specific target language it was designed for).
> was it due to haskell limitations or
> something else? how haske
G'day all.
Quoting Dan Piponi <[EMAIL PROTECTED]>:
> But I don't think that means there is no role for Haskell in
> rendering. Examples of places I think Haskell could play a role are:
> the shader language, [...]
For the record, I've written 2.5 production shader compilers. The
0.5 was in Hask
G'day all.
By "production grade", I assumed that meant "suitable for use in a
production".
Quoting Sebastian Sylvan <[EMAIL PROTECTED]>:
> Neither does mentalray!
Correct! Most production renderers don't have GUIs. Anything that
REQUIRES a GUI is by definition a toy because it can't be used i
G'day all.
Quoting Andrew Coppin <[EMAIL PROTECTED]>:
> The "Haskell ray tracer" seems to be a pretty standard and widely-used
> example program. But has anybody ever seriously tried to make a
> "production-grade" implementation? (I.e., one that is user-friendly,
> efficient, and with lots of fun
G'day.
One small suggestion.
Quoting Thomas Conway <[EMAIL PROTECTED]>:
> Just (v,e) -> do
> case e of
> True -> [...]
> False -> [...]
This works just as well:
Just (v,True) -> [...]
G'day.
Quoting Bulat Ziganshin <[EMAIL PROTECTED]>:
> sorry, but you really misunderstand how PPM works and why it's so
> efficient.
I understand PPM. I really do.
I think what you don't understand is why LZW does as well as it does
considering how simple it is. It's because it's a poor but c
G'day all.
Quoting Bulat Ziganshin <[EMAIL PROTECTED]>:
> it seems that you either misunderstood PPM or make too wide
> assumptions.
More likely I'm not explaining myself well.
> in classical fixed-order ppm each char probability
> found in context of previous N chars. i.e. when encoding abcdef
G'day all.
Quoting Bulat Ziganshin <[EMAIL PROTECTED]>:
> in this case why you proposes to encode lzw words with a huffman
> codes? :)
I don't. :-)
> oops. ppm build tree of contexts and use context to encode one char.
> lzw builds dictionary of words and encode word in empty context.
As you n
G'day.
Quoting Bulat Ziganshin <[EMAIL PROTECTED]>:
> well, ppm differs from simple order-0 coder in that it uses previous
> symbols to calculate probability. lzw differs from order-0 coder with
> flat static probabilities in that it encodes a whole word each time.
LZW doesn't have the concept o
G'day.
Quoting Bulat Ziganshin <[EMAIL PROTECTED]>:
> what you mean by "flat" and "static" applied to PPM? static PPM models
> exist - they carry probabilities as separate table very like static
> Huffman encoding. is "flat" the same as order-0?
"Static" means that the frequency distribution is
G'day all.
Andrew Coppin wrote:
> > Actually, LZW works surprisingly well for such a trivial little
> > algorithm... When you compare it to the complexity of an arithmetic
> > coder driven by a high-order adaptive PPM model (theoretically the best
> > general-purpose algorithm that exists), it's
G'day all.
Quoting Stefan O'Rear <[EMAIL PROTECTED]>:
> Data can only be constructed using constructors, but can be
> deconstructed [...]
You mean "nstructed".
Now if you'l excuse me, I'm off to write some "de".
Cheers,
Andrew Bromage
___
Haskell-Caf
G'day all.
Quoting Sebastian Sylvan <[EMAIL PROTECTED]>:
> Depends on your definition of "widely used".
There are more digital watches, freebie four-function calculators,
irritating-music-playing doorbells and furby-like toys pumped out
every year than there are PCs, servers, routers and mainfra
G'day.
Quoting Andrew Coppin <[EMAIL PROTECTED]>:
> True enough - but that's a rather specific task.
There are a lot of rather specific tasks out there.
Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.o
G'day all.
Quoting PR Stanley <[EMAIL PROTECTED]>:
> Discuss.
Here, have a deceased equine and a cat o' nine tails.
Please wait until I get to minimum safe distance before continuing.
Thanks!
Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
Haske
G'day all.
Quoting Dan Mead <[EMAIL PROTECTED]>:
> is that your implementation of LOLCODE?
O HAI IM IN UR CODE
REDUCIN' UR REDEKZEZ
BURNIN' UR MEGAHURTZ
Cheers,
Andrew Bromage
P.S. This is harder than writing l33t.
___
Ha
G'day all.
Quoting Donald Bruce Stewart <[EMAIL PROTECTED]>:
> I'd just add that the response is literally overwhelming!
As opposed to figuratively overwhelming?
I'm certain this book will have a very good editor at O'Reilly!
Cheers,
Andrew Bromage
_
G'day all.
Quoting Antoine Latter <[EMAIL PROTECTED]>:
> I'm a relatively new to Haskell, so I figured I needed to write a Sudoku
> solver.
Excellent! Please add it to the wiki:
http://www.haskell.org/haskellwiki/Sudoku
> The key features of this solver are:
>
> * It's longer than other
G'day all.
Quoting Henning Thielemann <[EMAIL PROTECTED]>:
> Why replacing the almost-function 'if' by a special syntactic construct?
In a sense, this is entirely stylistic. One works just as well as
the other.
But I think it's superior in this case (obviously not all cases) because
this is at
G'day all.
Quoting "Michael T. Richter" <[EMAIL PROTECTED]>:
> Ummm... Udo? Just what the fuck did you hope to accomplish with this
> kind of talk?
Guys, could we keep it civil on the list, please?
And for the record:
http://www.perl.com/pub/2000/12/advocacy.html
Cheers,
Andrew Bromage
G'day all.
I wrote:
> > insert :: a -> Bloom a -> Bloom a
> >
> > That way, you can use it with foldr.
Quoting Josef Svenningsson <[EMAIL PROTECTED]>:
> Hmmm. If you want to create a Bloom using a fold wouldn't it make more
> sense to use foldl'? I think the argument order is fine.
You're
G'day all.
Quoting Dom <[EMAIL PROTECTED]>:
> But better than what is in Codec.Utils:
[deletia]
> It seems a shame that everyone has to roll their own.
That and integer log base 2.
Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
Haskell-Cafe@hask
G'day.
Quoting tom <[EMAIL PROTECTED]>:
> I'm pretty new to Haskell, I've been working on a Bloom filter[1]
> implementation as a learning exercise.
Excellent! Sounds like a fun test.
> I'd really appreciate it if someone more experienced would comment on
> the code. I'm sure there's plenty of
G'day all.
Quoting Bryan O'Sullivan <[EMAIL PROTECTED]>:
> Well... The zipWith (^) should be map (uncurry (^)).
Err... yes.
> And the performance of this approach is strongly dependent on the
> efficiency of your prime sieve, so you're moving the complexity around,
> not eliminating it.
Yes an
G'day all.
Quoting Dan Weston <[EMAIL PROTECTED]>:
> Why all the fuss? n! is in fact very easily *completely* factored into
> prime numbers [...]
It's even easier than that.
primePowerOf :: Integer -> Integer -> Integer
primePowerOf n p
= (n - s p n) `div` (p-1)
where
s p 0 = 0
s p
G'day all.
Quoting Isaac Dupree <[EMAIL PROTECTED]>:
> Okay, looking at that code:
> The comments before the type definitions are mostly good...
> now it looks like I'm going into critique mode :)
BTW, for the record, I didn't try too hard with this. It is meant
to be illustrative of what you c
G'day all.
Quoting Simon Peyton-Jones <[EMAIL PROTECTED]>:
> Lots of interesting ideas on this thread, and Haskell-Cafe threads are
> *supposed* to wander a bit. But, just to remind you all: I'm particularly
> interested in
>
> concrete examples (pref running code) of programs that are
>
G'day all.
Quoting apfelmus <[EMAIL PROTECTED]>:
> (Btw, pairs (Int,Int) are members of the Ix class as well, so there is
> no need to generate an array of arrays.
I know. It originally used lists, which is why it looks like that. I
only allowed myself half an hour to write & debug this, so wh
G'day all.
I wrote:
> I think you could. What you need to convince a strict programmer of is
> that laziness gives you modularity. The Graham Hutton Sudoku solver is
> a nice example, but it'd be cool if we had a similar example that was
> less cheesy than Sudoku.
OK, it's not pretty, but this
G'day all.
Quoting Neil Mitchell <[EMAIL PROTECTED]>:
> I think its important to cover whats different about Haskell. Things
> like laziness are cool, but are harder to convince a strict programmer
> that they are useful.
I think you could. What you need to convince a strict programmer of is
th
G'day all.
I wrote:
> > O(log(n! / (n-k)!))
> > = O(n log n - (n-k) log (n-k))
> > = O(n log (n/(n-k)) + k log (n-k))
> >
> > That looks right to me. If k << n, then this simplifies to
> > O(n + k log n), and if k is close to n, it simplifies to
> > O(n log n + k).
Quoting Ian Lynagh <[EMAIL
G'day all.
Quoting Thomas Hartman <[EMAIL PROTECTED]>:
> Does that mean you can have the k minima in O(n) time, where n is
> length of list, which would seem to be an improvement?
It's worth considering what the theoretical minimum is.
You have n elements, and you need to locate a specific k-el
G'day all.
Quoting apfelmus <[EMAIL PROTECTED]>:
> You mean O(k * log n + n) of course.
Erm, yes. You can do it in an imperative language by building a heap
in O(n) time followed by removing k elements, in O(k log n) time.
Cheers,
Andrew Bromage
___
G'day all.
Quoting Kurt Hutchinson <[EMAIL PROTECTED]>:
> For my own edification, what is the benefit of this sortWith over sortBy?
None. I wanted to write my own sort, illustrating how the lazy
evaluation thing works, and I didn't want a name clash with an
existing library function.
Cheers,
A
G'day all.
Quoting raghu vardhan <[EMAIL PROTECTED]>:
> So, any algorithm that sorts is no good (think of n as huge, and k small).
The essence of all the answers that you've received is that it doesn't
matter if k is small, sorting is still the most elegant answer in Haskell.
The reason is that
G'day all.
Quoting raghu vardhan <[EMAIL PROTECTED]>:
> What's the best way to implement the following function in haskell:
> Given a list and an integer k as input return the indices of the least k
> elements in the list. The code should be elegant and also, more importantly,
> must not make mor
G'day all.
Quoting Neil Mitchell <[EMAIL PROTECTED]>:
> Yes. It will break 100's of applications.
That sounds like a challenge! Find me 100 applications that use
Data.Map.map and I will eat crow.
Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list
H
101 - 200 of 370 matches
Mail list logo