From: skaller <skaller@users.sourceforge.net>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Snd question
Date: Wed, 17 Aug 2005 16:55:02 +1000 [thread overview]
Message-ID: <1124261702.6858.21.camel@localhost.localdomain> (raw)
In-Reply-To: <200508162242.50803.jon@ffconsultancy.com>
[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]
On Tue, 2005-08-16 at 22:42 +0100, Jon Harrop wrote:
> Has anyone done any ad-hoc polymorphism (if that's the right jargon, I mean
> the equivalent of "+" for both int and float in SML) for containers? I
> haven't finished it yet but I've recently been playing with a term-level
> mini-Caml interpreter that I was going to add this functionality to. So
> "fold", "map" and so on are built into the language and can be applied to the
> built-in data structures set, list and array.
Jay's Functorial ML describes how to do this properly:
map, fold, etc, can be applied to any
polynomial type (a type built out of sums, products,
and induction). This is polyadic = functorially polymorphic,
not ad hoc.
The rules are things like:
map <f,g> (a,b) = (map f a, map g b)
(where <f,g> is the parallel composition of f and g).
Basically, things like 'list', 'tree', etc,
are functors, and map is just a function which takes a
functor argument and returns a map for that functor.
That is, this 'map', 'fold' etc are polyadic: they accept a functor
and return another functor.
--
John Skaller <skaller at users dot sourceforge dot net>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-08-17 6:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-15 22:05 Anu Engineer
2005-08-15 22:41 ` [Caml-list] " Matt Gushee
2005-08-16 8:08 ` sejourne kevin
2005-08-16 13:17 ` skaller
2005-08-16 16:16 ` Julian Brown
2005-08-16 17:18 ` [Caml-list] " Alan Falloon
2005-08-17 6:15 ` skaller
2005-08-16 16:34 ` [Caml-list] " Jon Harrop
2005-08-16 18:16 ` Richard Jones
2005-08-16 21:42 ` Jon Harrop
2005-08-17 6:55 ` skaller [this message]
2005-08-18 8:20 ` Andrej Bauer
2005-08-18 17:51 ` skaller
2005-08-19 7:50 ` Andrej Bauer
2005-08-17 12:19 ` Alain Frisch
2005-08-17 17:21 ` skaller
2005-08-17 23:08 ` Martin Jambon
2005-08-17 6:28 ` skaller
2005-08-20 14:31 ` Brian Hurt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1124261702.6858.21.camel@localhost.localdomain \
--to=skaller@users.sourceforge.net \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox