[m-rev.] for review: Added cord.condense/2

Paul Bone paul at bone.id.au
Mon Jul 1 22:07:54 AEST 2013


On Mon, Jul 01, 2013 at 09:37:40PM +1000, Julien Fischer wrote:
> On Mon, Jul 1, 2013 at 4:57 PM, Julien Fischer <jfischer at opturion.com>wrote:
> 
> >
> > On Mon, 1 Jul 2013, Paul Bone wrote:
> >
> >  For review by anyuone.
> >>
> >> Added cord.condense/2
> >>
> >> library/cord.m:
> >>    Added new predicate and function
> >>
> >
> > Full stop after that.
> >
> >
> > I don't think there should be a predicate version.
> > (I know the list module often defines both predicate and function
> > versions of things that are naturally functions, but that's largely for
> > historical reasons.)
> >
> 
> Actually, in some cases we have the predicate versions because they
> are useful with state variables -- I don't think that's likely to be the
> case
> with condense though because the input and output types differ.

Agreed,

I've removed the predicate version because as you said earlier, this is
natrually a function.

> ( Aside: it did occur to me that the following extension to state variable
> notation might
> be nice for function applications:
> 
>     !A = foo
> 
>     ===> !:A = foo(!.A)
> 
> or more generally:
> 
>     !A = foo(B1, B2, ..., BN)
> 
>     ===> !:A = foo(B1, B2, ..., BN, !.A)
> 
> ).

I've seen several proposals for this, this is the nicest so far.  And simple
too.

It could be generalised further by somehow matching the missing parameter
not by position but by type (where doing so is unambigious).  However, I
think this turns something simple into something that's more complicated
than it needs to be (and therefore harder to use).

    !A = foo(B1, B2)

    ===> !:A = foo(!.A, B1, B2)


-- 
Paul Bone
http://www.bone.id.au



More information about the reviews mailing list