From: skaller <skaller@users.sourceforge.net>
To: Brian Hurt <bhurt@spnz.org>
Cc: Martin Jambon <martin_jambon@emailuser.net>,
caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Suggestion: Pervasives.identity
Date: 24 Apr 2004 12:09:02 +1000 [thread overview]
Message-ID: <1082772541.21205.665.camel@pelican.wigram> (raw)
In-Reply-To: <Pine.LNX.4.44.0404231046560.9460-100000@localhost.localdomain>
On Sat, 2004-04-24 at 01:48, Brian Hurt wrote:
> On Fri, 23 Apr 2004, Martin Jambon wrote:
> >
> > In the same style, we already have Pervasives.ignore, so why not
> > Pervasives.identity?
> Possibly stupid question: what use would this function be?
I use it with higher order functions. For example
I have a function:
type typed_expr = expr_t * type_t
map_typed_expr:
(expr_t -> expr_t) ->
(type_t -> type_t) ->
typed_expr_t -> typed_expr_t
Sometimes I wish to map only the typing in an expression,
and sometimes only the expression terms not the typing.
So I pass 'identity' as one of the arguments.
An identity function would also be useful in machine
generated code in a situation similar to the above
where the HOF was implemented in the code generator,
and you don't want to specialise the generator
but would rather the target compiler optimise
the application of 'identity' away.
So it is 'useful' -- but this is no argument
it should be in Pervasives.
--
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850,
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net
-------------------
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
prev parent reply other threads:[~2004-04-24 2:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-23 12:18 Martin Jambon
2004-04-23 12:56 ` Xavier Leroy
2004-04-23 13:26 ` Martin Jambon
2004-04-23 15:48 ` Brian Hurt
2004-04-23 16:26 ` Richard Jones
2004-04-24 2:09 ` skaller [this message]
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=1082772541.21205.665.camel@pelican.wigram \
--to=skaller@users.sourceforge.net \
--cc=bhurt@spnz.org \
--cc=caml-list@inria.fr \
--cc=martin_jambon@emailuser.net \
/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