> > > > - maximum compliance with current enums : the "applicative enums"
(let's
> > > > call them purely functional) proposal is not going this way since
it's
> > > > modifying quite a lot current enums
> > >
> > > In other words, functional enums are never, ever, going to be
acceptable.
> >
> > That's not exactly what I said (see below).
>
> That's true Nicolas, but what you said comes very close
> to saying you aren't willing to change the interface.
>
> Unfortunately, the interface *is* the problem.
>
I'll clarify my thinking then :
What kind of modifications are needed to support - for example - purely
functional enums ?
Theses :
val iter : ('a -> unit) -> 'a t -> unit
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
val fold : ('a -> 'b -> 'b) -> 'b -> 'a t -> 'b
val fold2 : ('a -> 'b -> 'c -> 'c) -> 'c -> 'a t -> 'b t -> 'c
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val iter2i : (int -> 'a -> 'b -> unit) -> 'a t -> 'b t -> unit
val foldi : (int -> 'a -> 'b -> 'b) -> 'b -> 'a t -> 'b
val fold2i : (int -> 'a -> 'b -> 'c -> 'c) -> 'c -> 'a t -> 'b t -> 'c
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val filter : ('a -> bool) -> 'a t -> 'a t
val filter_map : ('a -> 'b option) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val concat : 'a t t -> 'a t
val empty : unit -> 'a t
val from : (unit -> 'a) -> 'a t
val init : int -> (int -> 'a) -> 'a t
are part of Enum API, and I think that even with purely functional enums, we
don't need to modify their signatures. I'm open to any proposal of Enum
improvment the would keep this kind of Enum behavior (the ability to lazily
stack operations such as maps and filters) as long as performances doesn't
degrade too much (a good design/performances tradeoff is a winning choice).
That's why I'm really open to Brian proposal, not just rejecting it blindly,
as long as he/we comes with a working implementation that satisfy theses
goals.
Regards,
Nicolas Cannasse
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|