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
Re: [Caml-list] Applications written in O'Caml
[ 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] Simple question
Maxence Guesdon <> writes:

> You want your accum to be a 'a list, not 'a, so use it as a list :
> let rec apply_fun_list x f_list accum =
>   match f_list with
>      h::t ->
>            apply_fun_list x t (accum@(h x))
>    | [] ->
>         accum;;

erg, apply_fun_list become tail recursive, but it's in O(n^2) (when
the first version is in O(n)), and as @ is not tail recursive, this
doesn't resolve the problem of Usage of the stack....

better stick to the non tail recursive version that to do this.

Rémi Vanicat
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: