<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/3f199bf0a914676a5b41fbca1690aa6f"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-30T07:27:55"
  subject="Re: [Caml-list] OCaml 3.05 released"
  prev="2002/07/fee6c3e5331f7ec8db2fdd96df87865d"
  next="2002/07/d6c58cb6bc1c6fb69e2a493d4661fb64"
  prev-in-thread="2002/08/db899ec4bb5226b7562107f232561f89"
  next-in-thread="2002/07/d6c58cb6bc1c6fb69e2a493d4661fb64"
  prev-thread="2002/07/39e30771ef4adfd2f12faaf023bfdac5"
  next-thread="2002/07/ff7adba2f7751b11a6ba288c8fc0167a"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] OCaml 3.05 released">
<msg 
  url="2002/07/e279fbfc81d25f8b7b40690d1165d72d"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-29T12:45:29"
  subject="[Caml-list] OCaml 3.05 released">
<msg 
  url="2002/07/b6032d864b192b947849b9fc6bd7755e"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2002-07-29T14:36:37"
  subject="Re: [Caml-list] OCaml 3.05 released">
</msg>
<msg 
  url="2002/07/afd92811daf13a07857d793b1331ba9e"
  from="Shawn Wagner &lt;shawnw@s...&gt;"
  author="Shawn Wagner"
  date="2002-07-30T00:41:47"
  subject="Re: [Caml-list] OCaml 3.05 released">
</msg>
<msg 
  url="2002/07/0efd71474f4d41a39e4250aeddcf08e5"
  from="Scott J. &lt;jscott@p...&gt;"
  author="Scott J."
  date="2002-07-30T03:50:07"
  subject="Re: [Caml-list] OCaml 3.05 released">
<msg 
  url="2002/08/df90b1f50be1a11118e0740523aa551c"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-08-02T05:32:07"
  subject="Re: [Caml-list] OCaml 3.05 released">
<msg 
  url="2002/08/db899ec4bb5226b7562107f232561f89"
  from="tim@f..."
  author="tim@f..."
  date="2002-08-02T17:41:42"
  subject="Re: [Caml-list] OCaml 3.05 released">
</msg>
</msg>
<msg 
  url="2002/07/3f199bf0a914676a5b41fbca1690aa6f"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-30T07:27:55"
  subject="Re: [Caml-list] OCaml 3.05 released">
</msg>
<msg 
  url="2002/07/d6c58cb6bc1c6fb69e2a493d4661fb64"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-30T07:39:19"
  subject="[Caml-list] Serious typechecking error involving new polymorphism (crash)">
<msg 
  url="2002/07/343d65e7899036954a2f9d55ce4afb9d"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-30T07:58:47"
  subject="Re: [Caml-list] Serious typechecking error involving new polymorphism (crash)">
<msg 
  url="2002/07/36d92762dd1d6949dd33b7393d6c53fc"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-30T08:15:36"
  subject="Re: [Caml-list] Serious typechecking error involving new polymorphism (crash)">
<msg 
  url="2002/07/90e5f432d519e9e76f617660f10c0efa"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-30T08:48:01"
  subject="Re: [Caml-list] Serious typechecking error involving new polymorphism (crash)">
</msg>
</msg>
<msg 
  url="2002/07/8085b2926393438ac0fa119812ee60f2"
  from="Sven LUTHER &lt;luther@d...&gt;"
  author="Sven LUTHER"
  date="2002-07-30T08:34:21"
  subject="Re: [Caml-list] Serious typechecking error involving new polymorphism (crash)">
<msg 
  url="2002/07/1c4970cfde7596bd9b15e0902376769d"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-30T14:11:34"
  subject="Re: [Caml-list] bug-fix branches">
<msg 
  url="2002/08/ba82a5fb43839056c5e388becc2deb61"
  from="root &lt;root@i...&gt;"
  author="root"
  date="2002-08-01T09:54:12"
  subject="[Caml-list] 3.05 and future 3.06 binary compatibility ?">
<msg 
  url="2002/08/2c4fff8dccd93507970c04eca009cfdb"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-08-01T12:09:41"
  subject="[Caml-list] Re: 3.05 and future 3.06 binary compatibility ?">
<msg 
  url="2002/08/6e264e12e92f890051ea1175f97bbee3"
  from="Sven LUTHER &lt;luther@d...&gt;"
  author="Sven LUTHER"
  date="2002-08-01T16:02:43"
  subject="[Caml-list] Re: 3.05 and future 3.06 binary compatibility ?">
</msg>
<msg 
  url="2002/08/df67723af0add90a69999ff263607208"
  from="Sven LUTHER &lt;luther@d...&gt;"
  author="Sven LUTHER"
  date="2002-08-08T08:33:22"
  subject="[Caml-list] Re: 3.05 and future 3.06 binary compatibility ?">
<msg 
  url="2002/08/41914487b5180ba736af8cb0e967f3a2"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-08-10T10:12:42"
  subject="[Caml-list] Re: 3.05 and future 3.06 binary compatibility ?">
<msg 
  url="2002/08/e865d7ffc0f6cfcb7d96317b3b113b04"
  from="Sven LUTHER &lt;luther@d...&gt;"
  author="Sven LUTHER"
  date="2002-08-10T10:18:13"
  subject="[Caml-list] Re: 3.05 and future 3.06 binary compatibility ?">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/4473ba7d51d430e8719525d0744d943c"
  from="Sven LUTHER &lt;luther@d...&gt;"
  author="Sven LUTHER"
  date="2002-07-30T16:37:24"
  subject="Re: [Caml-list] bug-fix branches">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/b497de8320fda3100426c8f53eecb197"
  from="Dmitry Bely &lt;dbely@m...&gt;"
  author="Dmitry Bely"
  date="2002-07-30T07:55:28"
  subject="Re: [Caml-list] OCaml 3.05 released">
<msg 
  url="2002/07/3f28649c188a4e7ae0bf9965ec6c2967"
  from="Scott J. &lt;jscott@p...&gt;"
  author="Scott J."
  date="2002-07-30T15:01:31"
  subject="Re: [Caml-list] OCaml 3.05 released">
<msg 
  url="2002/07/2a2bcb8c76923b4de71a17c6b47bc869"
  from="Dmitry Bely &lt;dbely@m...&gt;"
  author="Dmitry Bely"
  date="2002-07-30T15:15:16"
  subject="Re: [Caml-list] OCaml 3.05 released">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/c2213777c53be1e9911cdba2fdcaabd7"
  from="Yaron M. Minsky &lt;yminsky@C...&gt;"
  author="Yaron M. Minsky"
  date="2002-07-30T11:49:06"
  subject="Re: [Caml-list] OCaml 3.05 released">
</msg>
<msg 
  url="2002/07/1202a549e6e87be5cee18a8b76937e94"
  from="Christophe Raffalli &lt;raffalli@u...&gt;"
  author="Christophe Raffalli"
  date="2002-07-30T22:15:10"
  subject="[Caml-list] Record with one non mutable filed">
</msg>
</msg>
</thread>

<contents>
&gt;&gt;&gt;&gt;&gt; "sj" == Scott J &lt;jscott@planetinternet.be&gt; writes:

    sj&gt; What is meant by first first-class polymorphism?

First class polymorphism in this case lets you define values with
polymorphic types at levels other than the top level, like so:

type foo = { test : 'a 'b . ('a -&gt; 'b) -&gt; 'a list -&gt; 'b list }
let a = { test = List.map }

# a.test;;
- : ('a -&gt; 'b) -&gt; 'a list -&gt; 'b list = &lt;fun&gt;
# a.test ((+) 1) [3; 5; 7];;
- : int list = [4; 6; 8]
# a.test ((^) "a") ["a"; "b"; "c"];;
- : string list = ["aa"; "ab"; "ac"]

For objects, this allows you to define a list type, complete with map
method, as an object.  For example:

class ['a] clist x =
  object
    method map : 'b . ('a -&gt; 'b) -&gt; 'b list = fun f -&gt; List.map f x
  end
let a = new clist [1;2;3]
let b = new clist ["a";"b";"c"]

# a #map (fun x -&gt; x + 1);;
- : int list = [2; 3; 4]
# b #map (fun x -&gt; x ^ "-");;
- : string list = ["a-"; "b-"; "c-"]

(Note: this is a very uninteresting definition if a list class, but it
should show you the kind of thing you can now do.)

John.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

