Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eray Ozkural <exa@k...>
Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
On Tuesday 20 January 2004 13:31, Markus Mottl wrote:
> "where" is one keyword, which I might find useful. Code can be made much
> more readable if function applications come first and values used in it
> are defined further below. Otherwise, the user may have to scan large
> portions of value definitions before getting to the "core" of a function.

Absolutely! It looks much better than 5 nested let scopes (although they are 
semantically identical). Where was this inefficient DFT function I had 
written. Ah, here  it is:
dft :: (RealFloat a) => (SampleVector (Complex a)) -> Int
    -> (SampleVector (Complex a))
dft x n =
    listArray (0, (n-1)) [transform f | f <- [0..(n-1)]]
    transform f = scale * (foldl1 (+) [freqcomp f k | k <- [0..(n-1)]])
    freqcomp f k = (x!k) * (exp_polar (-(2 * (fromIntegral k)
                                         * pi * (fromIntegral f) ) /
                                       (fromIntegral n)) )
    scale = 1/(fromIntegral n)

I find use of where keyword much more readable in many places.


Eray Ozkural (exa) <>
Comp. Sci. Dept., Bilkent University, Ankara  KDE Project:
www:  Malfunction:
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: