caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* functions' recursive construction
@ 2007-05-22 23:17 Damien Lefortier
  2007-05-22 23:21 ` [Caml-list] " Jon Harrop
  2008-07-07 18:01 ` Fabrice Marchant
  0 siblings, 2 replies; 14+ messages in thread
From: Damien Lefortier @ 2007-05-22 23:17 UTC (permalink / raw)
  To: caml-list

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 ?

-- 
Damien `Dam' Lefortier
The most important thing in the programming
language is the name      -- D. Knuth


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-07-08  9:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-22 23:17 functions' recursive construction Damien Lefortier
2007-05-22 23:21 ` [Caml-list] " Jon Harrop
2007-05-22 23:31   ` Lukasz Stafiniak
2007-05-22 23:32     ` Lukasz Stafiniak
2007-05-22 23:41       ` Jon Harrop
2007-05-23  6:25     ` Jean-Christophe Filliatre
2008-07-07 18:01 ` Fabrice Marchant
     [not found]   ` <a58674cc0807071304x1640d670sde3045a0920a5922@mail.gmail.com>
2008-07-07 18:28     ` Fabrice Marchant
2008-07-07 20:40       ` Jeremy Yallop
     [not found]   ` <C3DD7276-23D5-41BE-A272-7579586A5559@gmail.com>
2008-07-07 18:36     ` Fabrice Marchant
2008-07-07 20:25   ` Jeremy Yallop
2008-07-07 19:11     ` Fabrice Marchant
2008-07-07 22:48       ` asmadeus77
2008-07-08  9:24       ` Daniel Bünzli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).