From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Radu Grigore <radugrigore@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Writing the function Set.map using first-class modules and 4.00 inference
Date: Fri, 2 Nov 2012 17:00:13 +0100 [thread overview]
Message-ID: <CAPFanBG+OB4iE0N2H2Pp-adNNwwwA5xkmjDNez62LrOOvcq2FQ@mail.gmail.com> (raw)
In-Reply-To: <9d4b2966-a246-405e-a3fe-88e1667e5b96@googlegroups.com>
But when you map from an ASet to a BSet, there is no reason to assume
in general that the mapping function preserves the order, so I don't
think you can do without the O(n log n) worst case bound. You could
provide a specialized function that assumes that the mapping is
order-preserving (you could even check it at runtime with no
additional complexity cost, for added safety), but I'm not sure
order-preserving mappings happen that often in practice.
On Fri, Nov 2, 2012 at 4:11 PM, Radu Grigore <radugrigore@gmail.com> wrote:
> On Friday, November 2, 2012 2:59:17 PM UTC, Radu Grigore wrote:
>> Somebody should put the linear time [of_list] in the standard library.
>
> Actually, that should probably be called [of_sorted_list], to make it clear what it does. If you worry about having a function that requires a sorted list, then note that there is already one in the standard library: List.merge.
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
next prev parent reply other threads:[~2012-11-02 16:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.FUGAe9RTYsSPA4RwbpKO14B0oVo@ifi.uio.no>
2012-11-02 14:59 ` Radu Grigore
2012-11-02 15:11 ` Radu Grigore
2012-11-02 16:00 ` Gabriel Scherer [this message]
2012-11-02 16:21 ` Radu Grigore
[not found] <fa.yP8czrxqEGCABee05wzAlISIlN4@ifi.uio.no>
[not found] ` <fa.rve4x46ugIvZs4BizovvjOCeTG0@ifi.uio.no>
[not found] ` <fa.i9E+7rAvghoTZ1MXH4g+uL4dpCY@ifi.uio.no>
[not found] ` <fa.AX0JYJa8kXsH/YSZ08tuyBc8m+0@ifi.uio.no>
[not found] ` <fa.YAoOn2iUcpHbr53eeBfGhPTDvtM@ifi.uio.no>
2012-11-05 8:05 ` Radu Grigore
2012-11-05 10:12 ` Gabriel Scherer
2012-11-05 12:02 ` Radu Grigore
2012-11-01 21:00 Jeff Meister
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=CAPFanBG+OB4iE0N2H2Pp-adNNwwwA5xkmjDNez62LrOOvcq2FQ@mail.gmail.com \
--to=gabriel.scherer@gmail.com \
--cc=caml-list@inria.fr \
--cc=radugrigore@gmail.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