Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] This expression is not a function, it cannot be applied
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Remi VANICAT <vanicat@l...>
Subject: Re: [Caml-list] This expression is not a function, it cannot be applied
Johann Spies <jhspies@adept.co.za> writes:

> Hello,

> # let rec druk_tabel hoofsom pmnt j n maand  = match (maand, hoofsom) with
>    (n, 0.) -> ()
>   |(0., _) -> print_string "ongeldige tydperk\n"; print_newline()
>   | (_, _) ->  if maand == 1. then Printf.printf "Maand\tBedrag\tRente\tAfbetaal";
>                let rente = hoofsom *. j in
>                  let afbetaal = pmnt -. rente in 
>                    let nuwe_hoofsom = hoofsom -. afbetaal in
>                       druk_ry (maand hoofsom rente afbetaal);
> 		        druk_tabel nuwe_hoofsom pmnt j n maand+1;;
> 
>                 Characters 424-429:
> This expression is not a function, it cannot be applied
> ----------------------------
> The culprit is "maand " in the second last row (druk_ry (maand...))
> 
> Why can it not be applied?

you do a
match (maand, hoofsom) with
...
| (0.,_) ->

so the compiler thinks that maand is a float, not a function.
and then you do a 
(maand hoofsom rente afbetaal)
which mean: apply the function maand to the argument hoofsom rente and
afbetaal, so it is an error since maand is not a function.


-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr