Re: [Haskell-cafe] How odd...

2007-08-04 Thread Stephen Forrest
On 8/4/07, Dan Piponi [EMAIL PROTECTED] wrote:

 On 8/4/07, Albert Y. C. Lai [EMAIL PROTECTED] wrote:
  There is no reason to expect complex ** to agree with real **.

 There's every reason. It is standard mathematical practice to embed
 the integers in the rationals in the reals in the complex numbers and
 it is nice to have as many functions as possible respect that
 embedding.


A example I have seen before that illustrates some the difficulties with
preserving such behaviour is (-1)^(1/3).

Of course, taking the nth root is multi-valued, so if you're to return a
single value, you must choose a convention.  Many implementations I have
seen choose the solution with lowest argument (i.e. the first solution
encounted by a counterclockwise sweep through the plane starting at (1,0).)

With this interpretation, (-1)^(1/3) = 0.5 + sqrt(3)/2 * i.  If you go with
the real solution (-1) you might need to do so carefully in order to
preserve other useful properties of ^, like continuity.

Steve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Clearly, Haskell is ill-founded

2007-07-09 Thread Stephen Forrest

On 7/9/07, Daniel McAllansmith [EMAIL PROTECTED] wrote:


I wouldn't want to comment on the validity of his claim, maybe he's wrong, or
maybe he's... well, anyway... what I will say is I got a chuckle out of
the 'Citations' that Amazon lists.


As amusing as that thought is, it seems that this is regrettably an
error on Amazon's part.  After looking at the actual page images where
the alleged citations occur, there is nowhere any mention of this
book.  (How could there be?  It was just published.)

It looks like Amazon's citation database is mistakenly using the index
for the book _Beating Depression_ by John Rush (Toronto: John Wiley 
Sons, Canada Ltd., 1983).

Steve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Just curios

2007-06-11 Thread Stephen Forrest

On 6/10/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:



You're pretty close, actually :)  Names derived from Hebrew were
fairly common in the Bible belt back when he was born.  (Haskell
from השקל, wisdom.  I half suspect Curry has a Biblical origin
as well, from קרי.)




Bible belt?  Curry was born in Millis, Massachusetts, and grew up in Boston.

The word Haskell seems to occur much more frequently as a surname,
originating in the British Isles.  It seems more plausible that he got the
name Haskell from some relative or family friend somewhere than ascribing
a Hebrew origin for his name.

Steve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Prime finding

2007-02-22 Thread Stephen Forrest

On 2/22/07, Ruben Zilibowitz [EMAIL PROTECTED] wrote:


I see that there has been some discussion on the list about prime
finding algorithms recently. I just wanted to contribute my own
humble algorithm:

[snip]

Comparing it to some of the algorithms in:
http://www.haskell.org/pipermail/haskell-cafe/2007-February/022765.html

It seems to perform reasonably well. It also has the advantage of
being quite short.


It has the advantage of conciseness, and for small enough examples
will give reasonable results, though computing O(n/log(n)) gcds can be
very expensive.

One suggestion I would make is to build the list in reverse order.
Since the test proceeds through the list from left to right, and an
arbitrary positive integer is more likely to be divisible by a small
primes than a larger one, this ought to produce a faster result when
the input is composite.

Steve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Justification for Ord inheriting from Eq?

2006-04-09 Thread Stephen Forrest
On 4/7/06, Jared Updike [EMAIL PROTECTED] wrote:
  given an Ord instance (for a type T) a corresponding Eq instance can be
  given by:
 
  instance Eq T where
  a == b = compare a b == EQ

 where did this second -^ == come from? (I guess if if Ordering
 derives Eq :-) I think you meant

I think another poster essentially already said this, but the second
== comes from the Eq instance for type Ordering, which is in the
Prelude.  So this we can actually rely on.

Steve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Justification for Ord inheriting from Eq?

2006-04-06 Thread Stephen Forrest
On 4/6/06, Brian Hulley [EMAIL PROTECTED] wrote:
 What about:

 class Eq a where (==), (/=) :: ...
 class PartialOrd a where
  (), () :: a-a-Bool
  x  y = y  x

 class (PartialOrd a) = TotalOrd a where x = y = not (y  x) 
-- = not meaning inheritance but just a restriction on a for use of
 TotalOrd

A partial order can be defined in either of two ways, both of which
require some notion of equality.  If it is a weak partial order, you
need to require reflexivity, i.e. x=y implies R(x,y).  If it is a
strong partial order, you need to require irreflexivity.  So some
notion of equality is necessary in either case.  (I think the same is
true of preorders, if we want to generalize to that.)

So, if such a PartialOrd existed, it really should be between Eq and
Ord in the class hierarchy.

Steve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe