[Haskell-cafe] Re: Argument order of expNat (Was: map (-2) [1..5])

Aaron Denney wnoise at ofb.net
Mon Sep 11 11:42:55 EDT 2006


On 2006-09-11, Henning Thielemann <lemming at henning-thielemann.de> wrote:
>
> On Sat, 9 Sep 2006, Brian Hulley wrote:
>
>> > >     negate (expNat 4 2)
>> > > 
>> > > because this would free the ^ symbol for some more widely
>> > > applicable use, and would also make the particular choice of
>> > > exponentiation operator more explicit
>> > 
>> > Agreed, though I'd want expt to be part of a typeclass
>> > (possibly multi-parameter to get exp:: Integral a => a ->
>> > Natural -> a as an instance?).
>> 
>> Yes, a typeclass for exp would be ideal (and a newtype for Natural).
>
>
> What about (expNat exponent basis) ? This argument order is more
> convenient for partial application.
>
> Cf.
>  http://www.haskell.org/pipermail/haskell-cafe/2006-April/015329.html

I don't see anything in that message supporting either argument order.

Personally, I mostly use exponentials in the context of the fourier
transform.  Although it could be expressed by either varying the
exponent or the base, I find varying the exponent to be far more
natural.  Consider also the specialization we have of power: exp, with a
fixed base, but not square, with a fixed exponent.

-- 
Aaron Denney
-><-



More information about the Haskell-Cafe mailing list