Hi
I have put some comments and examples in the code now, and will continue
to do so as soon as i get time for it.
Please look at the code, and tell me if it is worth making into a part
of an official library. Or, even better, if someone has already done
this code, and in a better way.
You
Hi
[EMAIL PROTECTED] wrote:
G'day all.
Quoting Bo Herlin [EMAIL PROTECTED]:
Great! I like this a LOT.
...
I don't know if I count as a guru or not, but by all means. Want to
discuss this on-list or off-list?
The code kinda big already, 700 lines + an util-file, so i'll put it
on-line at http
Well, part of what I was doing was experimenting with what a library like
this should look like, even more than what it should do. For some
reason,
I kind of like writing this:
*Math.Prime is Prime 42
False
instead of this:
*Math.Prime isPrime 42
False
Great! I like
You might want to check out the archives of the mailing list, too. These
sorts of problems occasionally get solved. For the record, here are a few
of my attempts:
http://andrew.bromage.org/Fib.hs (Fairly fast Fibonacci numbers)
http://andrew.bromage.org/WheelPrime.hs (Fast
Doh, i have another question:
Lets say i do as you wrote:
class CRank a b where
rank :: a - b - Maybe Integer -- Nothing means b is out of range
or badly constructed
unrank :: a - Integer - Maybe b -- Nothing means rank is out of range
class CCountable a where
count :: a - Maybe
Hi again
Next approach:
module Cafe where
class CRankable a where
rank :: a b - b - Maybe Integer -- Nothing means b is out of
range or badly constructed
unrank :: a b - Integer - Maybe b -- Nothing means rank is out of
range
count :: a b - Maybe Integer -- Nothing means infinity
Benjamin Franksen wrote:
(lots of information...)
HTH,
Ben
Thank you, very generous indeed. This WILL certanly help, once i have
learned more of the basics ;-) I have to try out this
functional-dependencies-thing before i understand everything you have typed.
Thanks!
/Bo
Hi
I am trying to make a class like this:
class CRank a b where
rank :: a - b - Maybe Integer -- Nothing means b is out of range
or badly constructed
unrank :: a - Integer - Maybe b -- Nothing means rank is out of range
count :: a - Maybe Integer -- Nothing means infinity
with possible
Ok, i got it now, thanks for the help.
/Bo
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
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
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
(maxBound :: Int) * 2 1 * 1
== -2 1
which is again true!
If you want well-behaved rationals, I suppose you have to use Ratio Integer.
Hope this helps,
- Cale
On 4/13/05, Bo Herlin [EMAIL PROTECTED] wrote:
Hi
How come
foldr1 min [(maxBound::Int) % 1,1 % 2]
2147483647 % 1
but
foldr1 min
Keean Schupke wrote:
You can do this like:
(code)
This was a mouthful for me being a Haskell newbee, I have to chew on
this one ;-)
Thanks!
/Bo Herlin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
Mark Carroll wrote:
On Fri, 8 Apr 2005, Bo Herlin wrote:
(snip)
Is it possible to make this work?
This is an extension beyond the 1998 standard, but
http://haskell.org/hawiki/ExistentialTypes may be
interesting to you.
Yes, I think this is what I was aiming at.
Thanks!
/Bo Herlin
Is it possible to make this work?
/Bo Herlin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
15 matches
Mail list logo