Version française
Home     About     Download     Resources     Contact us    
Browse thread
functions' recursive construction
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Fabrice Marchant <fabricemarchant@f...>
Subject: Re: [Caml-list] functions' recursive construction
On Wed, 23 May 2007 01:17:08 +0200
"Damien Lefortier" <damien.lefortier@gmail.com> wrote:

> Hi,
> 
> I try to do a function f which takes one integer argument and returns
> a function g which returns its nth arguments.
> 
> For example f 3 gives g with let g = fun x -> fun y -> fun z -> z ;;
> 
> I tried to do that kind of f function.
> 
> let rec f = function
>     1 -> fun x -> x
>   | n -> fun _ -> f (n-1)
> ;;
> 
> But it does not work, any idea ?

  Hi List,

  Sometimes, trying to learn a bit more about OCaml, I dig into old List topics.
But here, outside Coq answer, I'm not sure to understand the explanations about the original OCaml question.
  Please, is it possible to write an OCaml function that would behave the way Damien Lefortier wish ?
 (I think the answer is 'No') Could you shed light on this ?

Thanks,

Fabrice