[functor] Change default arity of Function, Predicate and Procedure

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[functor] Change default arity of Function, Predicate and Procedure

Bruno P. Kinoshita
Hi all, 

In Java 8 and Guava the default arity of a Function is 1, but in [functor] it is 0, IOW, in Java 8 and Guava a Function is by default a UnaryFunction, while in [functor] it is a NullaryFunction.

What do you guys think of changing the default arity of Function, Procedure and Predicate in [functor] to 1, rather than 0?

Cheers
 
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Matt Benson-2
What about in pure functional languages e.g. Haskell?

Matt


On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
[hidden email]> wrote:

> Hi all,
>
> In Java 8 and Guava the default arity of a Function is 1, but in [functor]
> it is 0, IOW, in Java 8 and Guava a Function is by default a UnaryFunction,
> while in [functor] it is a NullaryFunction.
>
> What do you guys think of changing the default arity of Function,
> Procedure and Predicate in [functor] to 1, rather than 0?
>
> Cheers
>
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Bruno P. Kinoshita
In Haskell you define your functions and its arity.

// nullary function
a :: () => () -> String
a = "Hello World"
 
// unary function
b :: (Integral c) => c -: String
b x = "Hello Integral"

I think in Clojure and Scala you can define the arity of the function too.

For the users of [functor] I think it would be easier to migrate their code to Java 8, or use it with Java 8, if both [functor] and Java 8 Function classes had similar behaviour. That would be interesting especially if the lambda project provided a backport jar.

[functor] and lambda project provide 1 and 2 arities by default, but lambda doesn't provide nullary interfaces (or at least I couldn't find them in java.util.functions).

Cheers

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


----- Original Message -----

> From: Matt Benson <[hidden email]>
> To: Commons Developers List <[hidden email]>; Bruno P. Kinoshita <[hidden email]>
> Cc:
> Sent: Tuesday, January 29, 2013 8:57 PM
> Subject: Re: [functor] Change default arity of Function, Predicate and Procedure
>
> What about in pure functional languages e.g. Haskell?
>
> Matt
>
>
> On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
> [hidden email]> wrote:
>
>>  Hi all,
>>
>>  In Java 8 and Guava the default arity of a Function is 1, but in [functor]
>>  it is 0, IOW, in Java 8 and Guava a Function is by default a UnaryFunction,
>>  while in [functor] it is a NullaryFunction.
>>
>>  What do you guys think of changing the default arity of Function,
>>  Procedure and Predicate in [functor] to 1, rather than 0?
>>
>>  Cheers
>>
>>  Bruno P. Kinoshita
>>  http://kinoshita.eti.br
>>  http://tupilabs.com
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: [hidden email]
>>  For additional commands, e-mail: [hidden email]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Matt Benson-2
What about:

Arity (Marker)
|_Nullary extends Arity
|_Unary<A> extends Arity
|_Binary<L, R> extends Arity

?

Matt


On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
[hidden email]> wrote:

> In Haskell you define your functions and its arity.
>
> // nullary function
> a :: () => () -> String
> a = "Hello World"
>
> // unary function
> b :: (Integral c) => c -: String
> b x = "Hello Integral"
>
> I think in Clojure and Scala you can define the arity of the function too.
>
> For the users of [functor] I think it would be easier to migrate their
> code to Java 8, or use it with Java 8, if both [functor] and Java 8
> Function classes had similar behaviour. That would be interesting
> especially if the lambda project provided a backport jar.
>
> [functor] and lambda project provide 1 and 2 arities by default, but
> lambda doesn't provide nullary interfaces (or at least I couldn't find them
> in java.util.functions).
>
> Cheers
>
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
>
> ----- Original Message -----
> > From: Matt Benson <[hidden email]>
> > To: Commons Developers List <[hidden email]>; Bruno P.
> Kinoshita <[hidden email]>
> > Cc:
> > Sent: Tuesday, January 29, 2013 8:57 PM
> > Subject: Re: [functor] Change default arity of Function, Predicate and
> Procedure
> >
> > What about in pure functional languages e.g. Haskell?
> >
> > Matt
> >
> >
> > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
> > [hidden email]> wrote:
> >
> >>  Hi all,
> >>
> >>  In Java 8 and Guava the default arity of a Function is 1, but in
> [functor]
> >>  it is 0, IOW, in Java 8 and Guava a Function is by default a
> UnaryFunction,
> >>  while in [functor] it is a NullaryFunction.
> >>
> >>  What do you guys think of changing the default arity of Function,
> >>  Procedure and Predicate in [functor] to 1, rather than 0?
> >>
> >>  Cheers
> >>
> >>  Bruno P. Kinoshita
> >>  http://kinoshita.eti.br
> >>  http://tupilabs.com
> >>
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: [hidden email]
> >>  For additional commands, e-mail: [hidden email]
> >>
> >>
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Bruno P. Kinoshita-2
I think it makes sense and is clear what is does.

I thought in using {arity}Operation, but in Java 8 there are interfaces like BinaryOperator, and BinaryOperator extends BiFunction, so it would be confusing to users having something like interface BinaryFunction extends BinaryOperation in [functor].
 
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


----- Original Message -----

> From: Matt Benson <[hidden email]>
> To: Bruno P. Kinoshita <[hidden email]>
> Cc: Commons Developers List <[hidden email]>
> Sent: Wednesday, January 30, 2013 1:29 PM
> Subject: Re: [functor] Change default arity of Function, Predicate and Procedure
>
> What about:
>
> Arity (Marker)
> |_Nullary extends Arity
> |_Unary<A> extends Arity
> |_Binary<L, R> extends Arity
>
> ?
>
> Matt
>
>
> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
> [hidden email]> wrote:
>
>>  In Haskell you define your functions and its arity.
>>
>>  // nullary function
>>  a :: () => () -> String
>>  a = "Hello World"
>>
>>  // unary function
>>  b :: (Integral c) => c -: String
>>  b x = "Hello Integral"
>>
>>  I think in Clojure and Scala you can define the arity of the function too.
>>
>>  For the users of [functor] I think it would be easier to migrate their
>>  code to Java 8, or use it with Java 8, if both [functor] and Java 8
>>  Function classes had similar behaviour. That would be interesting
>>  especially if the lambda project provided a backport jar.
>>
>>  [functor] and lambda project provide 1 and 2 arities by default, but
>>  lambda doesn't provide nullary interfaces (or at least I couldn't
> find them
>>  in java.util.functions).
>>
>>  Cheers
>>
>>  Bruno P. Kinoshita
>>  http://kinoshita.eti.br
>>  http://tupilabs.com
>>
>>
>>  ----- Original Message -----
>>  > From: Matt Benson <[hidden email]>
>>  > To: Commons Developers List <[hidden email]>; Bruno P.
>>  Kinoshita <[hidden email]>
>>  > Cc:
>>  > Sent: Tuesday, January 29, 2013 8:57 PM
>>  > Subject: Re: [functor] Change default arity of Function, Predicate and
>>  Procedure
>>  >
>>  > What about in pure functional languages e.g. Haskell?
>>  >
>>  > Matt
>>  >
>>  >
>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
>>  > [hidden email]> wrote:
>>  >
>>  >>  Hi all,
>>  >>
>>  >>  In Java 8 and Guava the default arity of a Function is 1, but in
>>  [functor]
>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by default a
>>  UnaryFunction,
>>  >>  while in [functor] it is a NullaryFunction.
>>  >>
>>  >>  What do you guys think of changing the default arity of Function,
>>  >>  Procedure and Predicate in [functor] to 1, rather than 0?
>>  >>
>>  >>  Cheers
>>  >>
>>  >>  Bruno P. Kinoshita
>>  >>  http://kinoshita.eti.br
>>  >>  http://tupilabs.com
>>  >>
>>  >> 
> ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: [hidden email]
>>  >>  For additional commands, e-mail: [hidden email]
>>  >>
>>  >>
>>  >
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Bruno P. Kinoshita
Hi Matt, all, 

I'm messing with [functor] in my GitHub mirror [1]. You can find the commits in the master branch [2].

The Arity->Unary/Binary/Nullary interfaces look good. If there are no objections I would like to commit this change to the trunk in SVN.

There are other changes that I'll omit in this commit, but will start new threads here in the mailing list :o)

Thank you in advance!

[1] https://github.com/kinow/functor
[2] https://github.com/kinow/functor/commits/master

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


>________________________________
> From: Bruno P. Kinoshita <[hidden email]>
>To: Commons Developers List <[hidden email]>; "[hidden email]" <[hidden email]>
>Sent: Wednesday, January 30, 2013 3:58 PM
>Subject: Re: [functor] Change default arity of Function, Predicate and Procedure
>
>I think it makes sense and is clear what is does.
>
>I thought in using {arity}Operation, but in Java 8 there are interfaces like BinaryOperator, and BinaryOperator extends BiFunction, so it would be confusing to users having something like interface BinaryFunction extends BinaryOperation in [functor].

>Bruno P. Kinoshita
>http://kinoshita.eti.br
>http://tupilabs.com
>
>
>----- Original Message -----
>> From: Matt Benson <[hidden email]>
>> To: Bruno P. Kinoshita <[hidden email]>
>> Cc: Commons Developers List <[hidden email]>
>> Sent: Wednesday, January 30, 2013 1:29 PM
>> Subject: Re: [functor] Change default arity of Function, Predicate and Procedure
>>
>> What about:
>>
>> Arity (Marker)
>> |_Nullary extends Arity
>> |_Unary<A> extends Arity
>> |_Binary<L, R> extends Arity
>>
>> ?
>>
>> Matt
>>
>>
>> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
>> [hidden email]> wrote:
>>
>>>  In Haskell you define your functions and its arity.
>>>
>>>  // nullary function
>>>  a :: () => () -> String
>>>  a = "Hello World"
>>>
>>>  // unary function
>>>  b :: (Integral c) => c -: String
>>>  b x = "Hello Integral"
>>>
>>>  I think in Clojure and Scala you can define the arity of the function too.
>>>
>>>  For the users of [functor] I think it would be easier to migrate their
>>>  code to Java 8, or use it with Java 8, if both [functor] and Java 8
>>>  Function classes had similar behaviour. That would be interesting
>>>  especially if the lambda project provided a backport jar.
>>>
>>>  [functor] and lambda project provide 1 and 2 arities by default, but
>>>  lambda doesn't provide nullary interfaces (or at least I couldn't
>> find them
>>>  in java.util.functions).
>>>
>>>  Cheers
>>>
>>>  Bruno P. Kinoshita
>>>  http://kinoshita.eti.br
>>>  http://tupilabs.com
>>>
>>>
>>>  ----- Original Message -----
>>>  > From: Matt Benson <[hidden email]>
>>>  > To: Commons Developers List <[hidden email]>; Bruno P.
>>>  Kinoshita <[hidden email]>
>>>  > Cc:
>>>  > Sent: Tuesday, January 29, 2013 8:57 PM
>>>  > Subject: Re: [functor] Change default arity of Function, Predicate and
>>>  Procedure
>>>  >
>>>  > What about in pure functional languages e.g. Haskell?
>>>  >
>>>  > Matt
>>>  >
>>>  >
>>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
>>>  > [hidden email]> wrote:
>>>  >
>>>  >>  Hi all,
>>>  >>
>>>  >>  In Java 8 and Guava the default arity of a Function is 1, but in
>>>  [functor]
>>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by default a
>>>  UnaryFunction,
>>>  >>  while in [functor] it is a NullaryFunction.
>>>  >>
>>>  >>  What do you guys think of changing the default arity of Function,
>>>  >>  Procedure and Predicate in [functor] to 1, rather than 0?
>>>  >>
>>>  >>  Cheers
>>>  >>
>>>  >>  Bruno P. Kinoshita
>>>  >>  http://kinoshita.eti.br
>>>  >>  http://tupilabs.com
>>>  >>
>>>  >> 
>> ---------------------------------------------------------------------
>>>  >>  To unsubscribe, e-mail: [hidden email]
>>>  >>  For additional commands, e-mail: [hidden email]
>>>  >>
>>>  >>
>>>  >
>>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Matt Benson-2
Hi Bruno,
  No objections here about the Arity interfaces.  I see that your master
branch also contains changes to migrate Unary* to * and * to Nullary*.
Personally I am satisfied to align with lambda/guava if noone else objects.

Thanks,
Matt


On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
[hidden email]> wrote:

> Hi Matt, all,
>
> I'm messing with [functor] in my GitHub mirror [1]. You can find the
> commits in the master branch [2].
>
> The Arity->Unary/Binary/Nullary interfaces look good. If there are no
> objections I would like to commit this change to the trunk in SVN.
>
> There are other changes that I'll omit in this commit, but will start new
> threads here in the mailing list :o)
>
> Thank you in advance!
>
> [1] https://github.com/kinow/functor
> [2] https://github.com/kinow/functor/commits/master
>
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
>
> >________________________________
> > From: Bruno P. Kinoshita <[hidden email]>
> >To: Commons Developers List <[hidden email]>; "
> [hidden email]" <[hidden email]>
> >Sent: Wednesday, January 30, 2013 3:58 PM
> >Subject: Re: [functor] Change default arity of Function, Predicate and
> Procedure
> >
> >I think it makes sense and is clear what is does.
> >
> >I thought in using {arity}Operation, but in Java 8 there are interfaces
> like BinaryOperator, and BinaryOperator extends BiFunction, so it would be
> confusing to users having something like interface BinaryFunction extends
> BinaryOperation in [functor].
> >
> >Bruno P. Kinoshita
> >http://kinoshita.eti.br
> >http://tupilabs.com
> >
> >
> >----- Original Message -----
> >> From: Matt Benson <[hidden email]>
> >> To: Bruno P. Kinoshita <[hidden email]>
> >> Cc: Commons Developers List <[hidden email]>
> >> Sent: Wednesday, January 30, 2013 1:29 PM
> >> Subject: Re: [functor] Change default arity of Function, Predicate and
> Procedure
> >>
> >> What about:
> >>
> >> Arity (Marker)
> >> |_Nullary extends Arity
> >> |_Unary<A> extends Arity
> >> |_Binary<L, R> extends Arity
> >>
> >> ?
> >>
> >> Matt
> >>
> >>
> >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
> >> [hidden email]> wrote:
> >>
> >>>  In Haskell you define your functions and its arity.
> >>>
> >>>  // nullary function
> >>>  a :: () => () -> String
> >>>  a = "Hello World"
> >>>
> >>>  // unary function
> >>>  b :: (Integral c) => c -: String
> >>>  b x = "Hello Integral"
> >>>
> >>>  I think in Clojure and Scala you can define the arity of the function
> too.
> >>>
> >>>  For the users of [functor] I think it would be easier to migrate their
> >>>  code to Java 8, or use it with Java 8, if both [functor] and Java 8
> >>>  Function classes had similar behaviour. That would be interesting
> >>>  especially if the lambda project provided a backport jar.
> >>>
> >>>  [functor] and lambda project provide 1 and 2 arities by default, but
> >>>  lambda doesn't provide nullary interfaces (or at least I couldn't
> >> find them
> >>>  in java.util.functions).
> >>>
> >>>  Cheers
> >>>
> >>>  Bruno P. Kinoshita
> >>>  http://kinoshita.eti.br
> >>>  http://tupilabs.com
> >>>
> >>>
> >>>  ----- Original Message -----
> >>>  > From: Matt Benson <[hidden email]>
> >>>  > To: Commons Developers List <[hidden email]>; Bruno P.
> >>>  Kinoshita <[hidden email]>
> >>>  > Cc:
> >>>  > Sent: Tuesday, January 29, 2013 8:57 PM
> >>>  > Subject: Re: [functor] Change default arity of Function, Predicate
> and
> >>>  Procedure
> >>>  >
> >>>  > What about in pure functional languages e.g. Haskell?
> >>>  >
> >>>  > Matt
> >>>  >
> >>>  >
> >>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
> >>>  > [hidden email]> wrote:
> >>>  >
> >>>  >>  Hi all,
> >>>  >>
> >>>  >>  In Java 8 and Guava the default arity of a Function is 1, but in
> >>>  [functor]
> >>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by default a
> >>>  UnaryFunction,
> >>>  >>  while in [functor] it is a NullaryFunction.
> >>>  >>
> >>>  >>  What do you guys think of changing the default arity of Function,
> >>>  >>  Procedure and Predicate in [functor] to 1, rather than 0?
> >>>  >>
> >>>  >>  Cheers
> >>>  >>
> >>>  >>  Bruno P. Kinoshita
> >>>  >>  http://kinoshita.eti.br
> >>>  >>  http://tupilabs.com
> >>>  >>
> >>>  >>
> >> ---------------------------------------------------------------------
> >>>  >>  To unsubscribe, e-mail: [hidden email]
> >>>  >>  For additional commands, e-mail: [hidden email]
> >>>  >>
> >>>  >>
> >>>  >
> >>>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]
> >
> >
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Bruno P. Kinoshita-2
Hi Matt!

Great! I'll commit these changes tomorrow if there are no objections.

Thanks!
 
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


----- Original Message -----

> From: Matt Benson <[hidden email]>
> To: Commons Developers List <[hidden email]>
> Cc:
> Sent: Monday, February 11, 2013 8:39 PM
> Subject: Re: [functor] Change default arity of Function, Predicate and Procedure
>
> Hi Bruno,
>   No objections here about the Arity interfaces.  I see that your master
> branch also contains changes to migrate Unary* to * and * to Nullary*.
> Personally I am satisfied to align with lambda/guava if noone else objects.
>
> Thanks,
> Matt
>
>
> On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> [hidden email]> wrote:
>
>>  Hi Matt, all,
>>
>>  I'm messing with [functor] in my GitHub mirror [1]. You can find the
>>  commits in the master branch [2].
>>
>>  The Arity->Unary/Binary/Nullary interfaces look good. If there are no
>>  objections I would like to commit this change to the trunk in SVN.
>>
>>  There are other changes that I'll omit in this commit, but will start
> new
>>  threads here in the mailing list :o)
>>
>>  Thank you in advance!
>>
>>  [1] https://github.com/kinow/functor
>>  [2] https://github.com/kinow/functor/commits/master
>>
>>  Bruno P. Kinoshita
>>  http://kinoshita.eti.br
>>  http://tupilabs.com
>>
>>
>>  >________________________________
>>  > From: Bruno P. Kinoshita <[hidden email]>
>>  >To: Commons Developers List <[hidden email]>; "
>>  [hidden email]" <[hidden email]>
>>  >Sent: Wednesday, January 30, 2013 3:58 PM
>>  >Subject: Re: [functor] Change default arity of Function, Predicate and
>>  Procedure
>>  >
>>  >I think it makes sense and is clear what is does.
>>  >
>>  >I thought in using {arity}Operation, but in Java 8 there are interfaces
>>  like BinaryOperator, and BinaryOperator extends BiFunction, so it would be
>>  confusing to users having something like interface BinaryFunction extends
>>  BinaryOperation in [functor].
>>  >
>>  >Bruno P. Kinoshita
>>  >http://kinoshita.eti.br
>>  >http://tupilabs.com
>>  >
>>  >
>>  >----- Original Message -----
>>  >> From: Matt Benson <[hidden email]>
>>  >> To: Bruno P. Kinoshita <[hidden email]>
>>  >> Cc: Commons Developers List <[hidden email]>
>>  >> Sent: Wednesday, January 30, 2013 1:29 PM
>>  >> Subject: Re: [functor] Change default arity of Function, Predicate
> and
>>  Procedure
>>  >>
>>  >> What about:
>>  >>
>>  >> Arity (Marker)
>>  >> |_Nullary extends Arity
>>  >> |_Unary<A> extends Arity
>>  >> |_Binary<L, R> extends Arity
>>  >>
>>  >> ?
>>  >>
>>  >> Matt
>>  >>
>>  >>
>>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
>>  >> [hidden email]> wrote:
>>  >>
>>  >>>  In Haskell you define your functions and its arity.
>>  >>>
>>  >>>  // nullary function
>>  >>>  a :: () => () -> String
>>  >>>  a = "Hello World"
>>  >>>
>>  >>>  // unary function
>>  >>>  b :: (Integral c) => c -: String
>>  >>>  b x = "Hello Integral"
>>  >>>
>>  >>>  I think in Clojure and Scala you can define the arity of the
> function
>>  too.
>>  >>>
>>  >>>  For the users of [functor] I think it would be easier to
> migrate their
>>  >>>  code to Java 8, or use it with Java 8, if both [functor] and
> Java 8
>>  >>>  Function classes had similar behaviour. That would be
> interesting
>>  >>>  especially if the lambda project provided a backport jar.
>>  >>>
>>  >>>  [functor] and lambda project provide 1 and 2 arities by
> default, but
>>  >>>  lambda doesn't provide nullary interfaces (or at least I
> couldn't
>>  >> find them
>>  >>>  in java.util.functions).
>>  >>>
>>  >>>  Cheers
>>  >>>
>>  >>>  Bruno P. Kinoshita
>>  >>>  http://kinoshita.eti.br
>>  >>>  http://tupilabs.com
>>  >>>
>>  >>>
>>  >>>  ----- Original Message -----
>>  >>>  > From: Matt Benson <[hidden email]>
>>  >>>  > To: Commons Developers List
> <[hidden email]>; Bruno P.
>>  >>>  Kinoshita <[hidden email]>
>>  >>>  > Cc:
>>  >>>  > Sent: Tuesday, January 29, 2013 8:57 PM
>>  >>>  > Subject: Re: [functor] Change default arity of Function,
> Predicate
>>  and
>>  >>>  Procedure
>>  >>>  >
>>  >>>  > What about in pure functional languages e.g. Haskell?
>>  >>>  >
>>  >>>  > Matt
>>  >>>  >
>>  >>>  >
>>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
>>  >>>  > [hidden email]> wrote:
>>  >>>  >
>>  >>>  >>  Hi all,
>>  >>>  >>
>>  >>>  >>  In Java 8 and Guava the default arity of a Function
> is 1, but in
>>  >>>  [functor]
>>  >>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by
> default a
>>  >>>  UnaryFunction,
>>  >>>  >>  while in [functor] it is a NullaryFunction.
>>  >>>  >>
>>  >>>  >>  What do you guys think of changing the default
> arity of Function,
>>  >>>  >>  Procedure and Predicate in [functor] to 1, rather
> than 0?
>>  >>>  >>
>>  >>>  >>  Cheers
>>  >>>  >>
>>  >>>  >>  Bruno P. Kinoshita
>>  >>>  >>  http://kinoshita.eti.br
>>  >>>  >>  http://tupilabs.com
>>  >>>  >>
>>  >>>  >>
>>  >>
> ---------------------------------------------------------------------
>>  >>>  >>  To unsubscribe, e-mail:
> [hidden email]
>>  >>>  >>  For additional commands, e-mail:
> [hidden email]
>>  >>>  >>
>>  >>>  >>
>>  >>>  >
>>  >>>
>>  >>
>>  >
>>  >---------------------------------------------------------------------
>>  >To unsubscribe, e-mail: [hidden email]
>>  >For additional commands, e-mail: [hidden email]
>>  >
>>  >
>>  >
>>  >
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Benedikt Ritter-4
Hi Guys,

I've had a look at the github repo and let me say at first that I'm no
expert in functional programming. So maybe what I'm talking is complete
nonsense :)

From what I learned about the concept of arity at wikipedia it seems that
an arity is a property of a functor.
One could say: "A binary functor has an arity of two" (right?!)

In the github repo you introduced an inheritance relationship between
functors and arity.
This maybe a good thing to do from a pracmatic POV because all functors
share the fact that say have an arity.

From an object oriented POV inheritance is more then pure reuse. When
defining an inheritance relationship between concept Super and concept Sub
we basically say "Every instance of Sub is also an instance of Super" or
short "Every Sub is also a Super"

Now coming back to functors you have introduced a relationship that says
"Every BinaryFunction is a Binary and every Binary is an Arity".
Keeping in mind that arity is only a property of a functor (rather than a
superset) this seems strange (from an OO POV).
But as I'm no expert on functional programming this maybe the right thing
to do... :)

just my 2 cents :)
Benedikt



2013/2/11 Bruno P. Kinoshita <[hidden email]>

> Hi Matt!
>
> Great! I'll commit these changes tomorrow if there are no objections.
>
> Thanks!
>
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
>
> ----- Original Message -----
> > From: Matt Benson <[hidden email]>
> > To: Commons Developers List <[hidden email]>
> > Cc:
> > Sent: Monday, February 11, 2013 8:39 PM
> > Subject: Re: [functor] Change default arity of Function, Predicate and
> Procedure
> >
> > Hi Bruno,
> >   No objections here about the Arity interfaces.  I see that your master
> > branch also contains changes to migrate Unary* to * and * to Nullary*.
> > Personally I am satisfied to align with lambda/guava if noone else
> objects.
> >
> > Thanks,
> > Matt
> >
> >
> > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> > [hidden email]> wrote:
> >
> >>  Hi Matt, all,
> >>
> >>  I'm messing with [functor] in my GitHub mirror [1]. You can find the
> >>  commits in the master branch [2].
> >>
> >>  The Arity->Unary/Binary/Nullary interfaces look good. If there are no
> >>  objections I would like to commit this change to the trunk in SVN.
> >>
> >>  There are other changes that I'll omit in this commit, but will start
> > new
> >>  threads here in the mailing list :o)
> >>
> >>  Thank you in advance!
> >>
> >>  [1] https://github.com/kinow/functor
> >>  [2] https://github.com/kinow/functor/commits/master
> >>
> >>  Bruno P. Kinoshita
> >>  http://kinoshita.eti.br
> >>  http://tupilabs.com
> >>
> >>
> >>  >________________________________
> >>  > From: Bruno P. Kinoshita <[hidden email]>
> >>  >To: Commons Developers List <[hidden email]>; "
> >>  [hidden email]" <[hidden email]>
> >>  >Sent: Wednesday, January 30, 2013 3:58 PM
> >>  >Subject: Re: [functor] Change default arity of Function, Predicate and
> >>  Procedure
> >>  >
> >>  >I think it makes sense and is clear what is does.
> >>  >
> >>  >I thought in using {arity}Operation, but in Java 8 there are
> interfaces
> >>  like BinaryOperator, and BinaryOperator extends BiFunction, so it
> would be
> >>  confusing to users having something like interface BinaryFunction
> extends
> >>  BinaryOperation in [functor].
> >>  >
> >>  >Bruno P. Kinoshita
> >>  >http://kinoshita.eti.br
> >>  >http://tupilabs.com
> >>  >
> >>  >
> >>  >----- Original Message -----
> >>  >> From: Matt Benson <[hidden email]>
> >>  >> To: Bruno P. Kinoshita <[hidden email]>
> >>  >> Cc: Commons Developers List <[hidden email]>
> >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
> >>  >> Subject: Re: [functor] Change default arity of Function, Predicate
> > and
> >>  Procedure
> >>  >>
> >>  >> What about:
> >>  >>
> >>  >> Arity (Marker)
> >>  >> |_Nullary extends Arity
> >>  >> |_Unary<A> extends Arity
> >>  >> |_Binary<L, R> extends Arity
> >>  >>
> >>  >> ?
> >>  >>
> >>  >> Matt
> >>  >>
> >>  >>
> >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
> >>  >> [hidden email]> wrote:
> >>  >>
> >>  >>>  In Haskell you define your functions and its arity.
> >>  >>>
> >>  >>>  // nullary function
> >>  >>>  a :: () => () -> String
> >>  >>>  a = "Hello World"
> >>  >>>
> >>  >>>  // unary function
> >>  >>>  b :: (Integral c) => c -: String
> >>  >>>  b x = "Hello Integral"
> >>  >>>
> >>  >>>  I think in Clojure and Scala you can define the arity of the
> > function
> >>  too.
> >>  >>>
> >>  >>>  For the users of [functor] I think it would be easier to
> > migrate their
> >>  >>>  code to Java 8, or use it with Java 8, if both [functor] and
> > Java 8
> >>  >>>  Function classes had similar behaviour. That would be
> > interesting
> >>  >>>  especially if the lambda project provided a backport jar.
> >>  >>>
> >>  >>>  [functor] and lambda project provide 1 and 2 arities by
> > default, but
> >>  >>>  lambda doesn't provide nullary interfaces (or at least I
> > couldn't
> >>  >> find them
> >>  >>>  in java.util.functions).
> >>  >>>
> >>  >>>  Cheers
> >>  >>>
> >>  >>>  Bruno P. Kinoshita
> >>  >>>  http://kinoshita.eti.br
> >>  >>>  http://tupilabs.com
> >>  >>>
> >>  >>>
> >>  >>>  ----- Original Message -----
> >>  >>>  > From: Matt Benson <[hidden email]>
> >>  >>>  > To: Commons Developers List
> > <[hidden email]>; Bruno P.
> >>  >>>  Kinoshita <[hidden email]>
> >>  >>>  > Cc:
> >>  >>>  > Sent: Tuesday, January 29, 2013 8:57 PM
> >>  >>>  > Subject: Re: [functor] Change default arity of Function,
> > Predicate
> >>  and
> >>  >>>  Procedure
> >>  >>>  >
> >>  >>>  > What about in pure functional languages e.g. Haskell?
> >>  >>>  >
> >>  >>>  > Matt
> >>  >>>  >
> >>  >>>  >
> >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
> >>  >>>  > [hidden email]> wrote:
> >>  >>>  >
> >>  >>>  >>  Hi all,
> >>  >>>  >>
> >>  >>>  >>  In Java 8 and Guava the default arity of a Function
> > is 1, but in
> >>  >>>  [functor]
> >>  >>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by
> > default a
> >>  >>>  UnaryFunction,
> >>  >>>  >>  while in [functor] it is a NullaryFunction.
> >>  >>>  >>
> >>  >>>  >>  What do you guys think of changing the default
> > arity of Function,
> >>  >>>  >>  Procedure and Predicate in [functor] to 1, rather
> > than 0?
> >>  >>>  >>
> >>  >>>  >>  Cheers
> >>  >>>  >>
> >>  >>>  >>  Bruno P. Kinoshita
> >>  >>>  >>  http://kinoshita.eti.br
> >>  >>>  >>  http://tupilabs.com
> >>  >>>  >>
> >>  >>>  >>
> >>  >>
> > ---------------------------------------------------------------------
> >>  >>>  >>  To unsubscribe, e-mail:
> > [hidden email]
> >>  >>>  >>  For additional commands, e-mail:
> > [hidden email]
> >>  >>>  >>
> >>  >>>  >>
> >>  >>>  >
> >>  >>>
> >>  >>
> >>  >
> >>  >---------------------------------------------------------------------
> >>  >To unsubscribe, e-mail: [hidden email]
> >>  >For additional commands, e-mail: [hidden email]
> >>  >
> >>  >
> >>  >
> >>  >
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Matt Benson-2
Hi Benedikt,
  So what you are pointing out is the "is a" vs. "has a" dichotomy?  To an
extent, I see your point.  I could argue that the semantics of the word
"implements" perhaps leaves a bit of so-called wiggle room on the is a/has
a subject.  This could devolve into a long discussion of the most
semantically correct place to use "implements Arity*" vs. "extends Arity*"
throughout the API, but the final result, IMO, is that the intent of any
given concrete class is clear enough, and Arity|Nullary|Unary|Binary|ad
infinitum seems more convenient than e.g. "SomethingThatHasArity", etc.

Does that make sense?

Matt


On Tue, Feb 12, 2013 at 7:29 AM, Benedikt Ritter <[hidden email]> wrote:

> Hi Guys,
>
> I've had a look at the github repo and let me say at first that I'm no
> expert in functional programming. So maybe what I'm talking is complete
> nonsense :)
>
> From what I learned about the concept of arity at wikipedia it seems that
> an arity is a property of a functor.
> One could say: "A binary functor has an arity of two" (right?!)
>
> In the github repo you introduced an inheritance relationship between
> functors and arity.
> This maybe a good thing to do from a pracmatic POV because all functors
> share the fact that say have an arity.
>
> From an object oriented POV inheritance is more then pure reuse. When
> defining an inheritance relationship between concept Super and concept Sub
> we basically say "Every instance of Sub is also an instance of Super" or
> short "Every Sub is also a Super"
>
> Now coming back to functors you have introduced a relationship that says
> "Every BinaryFunction is a Binary and every Binary is an Arity".
> Keeping in mind that arity is only a property of a functor (rather than a
> superset) this seems strange (from an OO POV).
> But as I'm no expert on functional programming this maybe the right thing
> to do... :)
>
> just my 2 cents :)
> Benedikt
>
>
>
> 2013/2/11 Bruno P. Kinoshita <[hidden email]>
>
> > Hi Matt!
> >
> > Great! I'll commit these changes tomorrow if there are no objections.
> >
> > Thanks!
> >
> > Bruno P. Kinoshita
> > http://kinoshita.eti.br
> > http://tupilabs.com
> >
> >
> > ----- Original Message -----
> > > From: Matt Benson <[hidden email]>
> > > To: Commons Developers List <[hidden email]>
> > > Cc:
> > > Sent: Monday, February 11, 2013 8:39 PM
> > > Subject: Re: [functor] Change default arity of Function, Predicate and
> > Procedure
> > >
> > > Hi Bruno,
> > >   No objections here about the Arity interfaces.  I see that your
> master
> > > branch also contains changes to migrate Unary* to * and * to Nullary*.
> > > Personally I am satisfied to align with lambda/guava if noone else
> > objects.
> > >
> > > Thanks,
> > > Matt
> > >
> > >
> > > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> > > [hidden email]> wrote:
> > >
> > >>  Hi Matt, all,
> > >>
> > >>  I'm messing with [functor] in my GitHub mirror [1]. You can find the
> > >>  commits in the master branch [2].
> > >>
> > >>  The Arity->Unary/Binary/Nullary interfaces look good. If there are no
> > >>  objections I would like to commit this change to the trunk in SVN.
> > >>
> > >>  There are other changes that I'll omit in this commit, but will start
> > > new
> > >>  threads here in the mailing list :o)
> > >>
> > >>  Thank you in advance!
> > >>
> > >>  [1] https://github.com/kinow/functor
> > >>  [2] https://github.com/kinow/functor/commits/master
> > >>
> > >>  Bruno P. Kinoshita
> > >>  http://kinoshita.eti.br
> > >>  http://tupilabs.com
> > >>
> > >>
> > >>  >________________________________
> > >>  > From: Bruno P. Kinoshita <[hidden email]>
> > >>  >To: Commons Developers List <[hidden email]>; "
> > >>  [hidden email]" <[hidden email]>
> > >>  >Sent: Wednesday, January 30, 2013 3:58 PM
> > >>  >Subject: Re: [functor] Change default arity of Function, Predicate
> and
> > >>  Procedure
> > >>  >
> > >>  >I think it makes sense and is clear what is does.
> > >>  >
> > >>  >I thought in using {arity}Operation, but in Java 8 there are
> > interfaces
> > >>  like BinaryOperator, and BinaryOperator extends BiFunction, so it
> > would be
> > >>  confusing to users having something like interface BinaryFunction
> > extends
> > >>  BinaryOperation in [functor].
> > >>  >
> > >>  >Bruno P. Kinoshita
> > >>  >http://kinoshita.eti.br
> > >>  >http://tupilabs.com
> > >>  >
> > >>  >
> > >>  >----- Original Message -----
> > >>  >> From: Matt Benson <[hidden email]>
> > >>  >> To: Bruno P. Kinoshita <[hidden email]>
> > >>  >> Cc: Commons Developers List <[hidden email]>
> > >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
> > >>  >> Subject: Re: [functor] Change default arity of Function, Predicate
> > > and
> > >>  Procedure
> > >>  >>
> > >>  >> What about:
> > >>  >>
> > >>  >> Arity (Marker)
> > >>  >> |_Nullary extends Arity
> > >>  >> |_Unary<A> extends Arity
> > >>  >> |_Binary<L, R> extends Arity
> > >>  >>
> > >>  >> ?
> > >>  >>
> > >>  >> Matt
> > >>  >>
> > >>  >>
> > >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
> > >>  >> [hidden email]> wrote:
> > >>  >>
> > >>  >>>  In Haskell you define your functions and its arity.
> > >>  >>>
> > >>  >>>  // nullary function
> > >>  >>>  a :: () => () -> String
> > >>  >>>  a = "Hello World"
> > >>  >>>
> > >>  >>>  // unary function
> > >>  >>>  b :: (Integral c) => c -: String
> > >>  >>>  b x = "Hello Integral"
> > >>  >>>
> > >>  >>>  I think in Clojure and Scala you can define the arity of the
> > > function
> > >>  too.
> > >>  >>>
> > >>  >>>  For the users of [functor] I think it would be easier to
> > > migrate their
> > >>  >>>  code to Java 8, or use it with Java 8, if both [functor] and
> > > Java 8
> > >>  >>>  Function classes had similar behaviour. That would be
> > > interesting
> > >>  >>>  especially if the lambda project provided a backport jar.
> > >>  >>>
> > >>  >>>  [functor] and lambda project provide 1 and 2 arities by
> > > default, but
> > >>  >>>  lambda doesn't provide nullary interfaces (or at least I
> > > couldn't
> > >>  >> find them
> > >>  >>>  in java.util.functions).
> > >>  >>>
> > >>  >>>  Cheers
> > >>  >>>
> > >>  >>>  Bruno P. Kinoshita
> > >>  >>>  http://kinoshita.eti.br
> > >>  >>>  http://tupilabs.com
> > >>  >>>
> > >>  >>>
> > >>  >>>  ----- Original Message -----
> > >>  >>>  > From: Matt Benson <[hidden email]>
> > >>  >>>  > To: Commons Developers List
> > > <[hidden email]>; Bruno P.
> > >>  >>>  Kinoshita <[hidden email]>
> > >>  >>>  > Cc:
> > >>  >>>  > Sent: Tuesday, January 29, 2013 8:57 PM
> > >>  >>>  > Subject: Re: [functor] Change default arity of Function,
> > > Predicate
> > >>  and
> > >>  >>>  Procedure
> > >>  >>>  >
> > >>  >>>  > What about in pure functional languages e.g. Haskell?
> > >>  >>>  >
> > >>  >>>  > Matt
> > >>  >>>  >
> > >>  >>>  >
> > >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
> > >>  >>>  > [hidden email]> wrote:
> > >>  >>>  >
> > >>  >>>  >>  Hi all,
> > >>  >>>  >>
> > >>  >>>  >>  In Java 8 and Guava the default arity of a Function
> > > is 1, but in
> > >>  >>>  [functor]
> > >>  >>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by
> > > default a
> > >>  >>>  UnaryFunction,
> > >>  >>>  >>  while in [functor] it is a NullaryFunction.
> > >>  >>>  >>
> > >>  >>>  >>  What do you guys think of changing the default
> > > arity of Function,
> > >>  >>>  >>  Procedure and Predicate in [functor] to 1, rather
> > > than 0?
> > >>  >>>  >>
> > >>  >>>  >>  Cheers
> > >>  >>>  >>
> > >>  >>>  >>  Bruno P. Kinoshita
> > >>  >>>  >>  http://kinoshita.eti.br
> > >>  >>>  >>  http://tupilabs.com
> > >>  >>>  >>
> > >>  >>>  >>
> > >>  >>
> > > ---------------------------------------------------------------------
> > >>  >>>  >>  To unsubscribe, e-mail:
> > > [hidden email]
> > >>  >>>  >>  For additional commands, e-mail:
> > > [hidden email]
> > >>  >>>  >>
> > >>  >>>  >>
> > >>  >>>  >
> > >>  >>>
> > >>  >>
> > >>  >
> > >>
>  >---------------------------------------------------------------------
> > >>  >To unsubscribe, e-mail: [hidden email]
> > >>  >For additional commands, e-mail: [hidden email]
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Benedikt Ritter-4
Hi Matt,

2013/2/12 Matt Benson <[hidden email]>

> Hi Benedikt,
>   So what you are pointing out is the "is a" vs. "has a" dichotomy?  To an
> extent, I see your point.  I could argue that the semantics of the word
> "implements" perhaps leaves a bit of so-called wiggle room on the is a/has
> a subject.


Now we are mixing things up. I was referring to the inheritance
relationships between the interfaces.

The java "implements" keyword is a different concept. Indeed, I'm not sure
if it (or the notion of Interfaces) is part of the OO paradigm at all.
There is an interesting paper about this topic (what are the core conecpts
of object orientation?) [1]...

Anyway the reason I'm bringing this rather academic topic up is, that I
believe that a clear object-orient design will lead to a better (= easier
to understand) API. People will work with the API. They will browse the
type hierarchy to understand how things are tied together.
This will lead to situations like: "okay, I have a BinaryFunction... what
is a BinaryFuncation? Ah, it's a Binary... what is a Binary? A Binary seems
to be an Arity... wait.. what?"

Maybe I can make myself clearer by giving a less abstract example.
Consider the following set of thinks: Cars, Trucks, Motorcycles.
They all have wheels of some sort. How would you model this using
Interfaces?
I'm sure you wouldn't define an interface "Wheel" that is extended by Car,
Truck and Motorcycle.
Instead you would probably define "Vehicle" with a "getNumberOfWheels()"
method and let Car, Truck and Motorcycle extend Vehicle.
This is what I meant when I said "Arity is not a superset of functors". it
is a property, like the number of Wheels is a property of all vehicles.

Again, this is all very academic. If you see it fit to create Arity and
have the different functors extend it, then do it :-)


> This could devolve into a long discussion of the most
> semantically correct place to use "implements Arity*" vs. "extends Arity*"
> throughout the API, but the final result, IMO, is that the intent of any
> given concrete class is clear enough, and Arity|Nullary|Unary|Binary|ad
> infinitum seems more convenient than e.g. "SomethingThatHasArity", etc.
>

I agree!


>
> Does that make sense?
>

As I said, I think pragmatism should win over OO purism :)


>
> Matt
>

Benedikt

[1] http://dl.acm.org/citation.cfm?id=1113040

>
>
> On Tue, Feb 12, 2013 at 7:29 AM, Benedikt Ritter <[hidden email]>
> wrote:
>
> > Hi Guys,
> >
> > I've had a look at the github repo and let me say at first that I'm no
> > expert in functional programming. So maybe what I'm talking is complete
> > nonsense :)
> >
> > From what I learned about the concept of arity at wikipedia it seems that
> > an arity is a property of a functor.
> > One could say: "A binary functor has an arity of two" (right?!)
> >
> > In the github repo you introduced an inheritance relationship between
> > functors and arity.
> > This maybe a good thing to do from a pracmatic POV because all functors
> > share the fact that say have an arity.
> >
> > From an object oriented POV inheritance is more then pure reuse. When
> > defining an inheritance relationship between concept Super and concept
> Sub
> > we basically say "Every instance of Sub is also an instance of Super" or
> > short "Every Sub is also a Super"
> >
> > Now coming back to functors you have introduced a relationship that says
> > "Every BinaryFunction is a Binary and every Binary is an Arity".
> > Keeping in mind that arity is only a property of a functor (rather than a
> > superset) this seems strange (from an OO POV).
> > But as I'm no expert on functional programming this maybe the right thing
> > to do... :)
> >
> > just my 2 cents :)
> > Benedikt
> >
> >
> >
> > 2013/2/11 Bruno P. Kinoshita <[hidden email]>
> >
> > > Hi Matt!
> > >
> > > Great! I'll commit these changes tomorrow if there are no objections.
> > >
> > > Thanks!
> > >
> > > Bruno P. Kinoshita
> > > http://kinoshita.eti.br
> > > http://tupilabs.com
> > >
> > >
> > > ----- Original Message -----
> > > > From: Matt Benson <[hidden email]>
> > > > To: Commons Developers List <[hidden email]>
> > > > Cc:
> > > > Sent: Monday, February 11, 2013 8:39 PM
> > > > Subject: Re: [functor] Change default arity of Function, Predicate
> and
> > > Procedure
> > > >
> > > > Hi Bruno,
> > > >   No objections here about the Arity interfaces.  I see that your
> > master
> > > > branch also contains changes to migrate Unary* to * and * to
> Nullary*.
> > > > Personally I am satisfied to align with lambda/guava if noone else
> > > objects.
> > > >
> > > > Thanks,
> > > > Matt
> > > >
> > > >
> > > > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> > > > [hidden email]> wrote:
> > > >
> > > >>  Hi Matt, all,
> > > >>
> > > >>  I'm messing with [functor] in my GitHub mirror [1]. You can find
> the
> > > >>  commits in the master branch [2].
> > > >>
> > > >>  The Arity->Unary/Binary/Nullary interfaces look good. If there are
> no
> > > >>  objections I would like to commit this change to the trunk in SVN.
> > > >>
> > > >>  There are other changes that I'll omit in this commit, but will
> start
> > > > new
> > > >>  threads here in the mailing list :o)
> > > >>
> > > >>  Thank you in advance!
> > > >>
> > > >>  [1] https://github.com/kinow/functor
> > > >>  [2] https://github.com/kinow/functor/commits/master
> > > >>
> > > >>  Bruno P. Kinoshita
> > > >>  http://kinoshita.eti.br
> > > >>  http://tupilabs.com
> > > >>
> > > >>
> > > >>  >________________________________
> > > >>  > From: Bruno P. Kinoshita <[hidden email]>
> > > >>  >To: Commons Developers List <[hidden email]>; "
> > > >>  [hidden email]" <[hidden email]>
> > > >>  >Sent: Wednesday, January 30, 2013 3:58 PM
> > > >>  >Subject: Re: [functor] Change default arity of Function, Predicate
> > and
> > > >>  Procedure
> > > >>  >
> > > >>  >I think it makes sense and is clear what is does.
> > > >>  >
> > > >>  >I thought in using {arity}Operation, but in Java 8 there are
> > > interfaces
> > > >>  like BinaryOperator, and BinaryOperator extends BiFunction, so it
> > > would be
> > > >>  confusing to users having something like interface BinaryFunction
> > > extends
> > > >>  BinaryOperation in [functor].
> > > >>  >
> > > >>  >Bruno P. Kinoshita
> > > >>  >http://kinoshita.eti.br
> > > >>  >http://tupilabs.com
> > > >>  >
> > > >>  >
> > > >>  >----- Original Message -----
> > > >>  >> From: Matt Benson <[hidden email]>
> > > >>  >> To: Bruno P. Kinoshita <[hidden email]>
> > > >>  >> Cc: Commons Developers List <[hidden email]>
> > > >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
> > > >>  >> Subject: Re: [functor] Change default arity of Function,
> Predicate
> > > > and
> > > >>  Procedure
> > > >>  >>
> > > >>  >> What about:
> > > >>  >>
> > > >>  >> Arity (Marker)
> > > >>  >> |_Nullary extends Arity
> > > >>  >> |_Unary<A> extends Arity
> > > >>  >> |_Binary<L, R> extends Arity
> > > >>  >>
> > > >>  >> ?
> > > >>  >>
> > > >>  >> Matt
> > > >>  >>
> > > >>  >>
> > > >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
> > > >>  >> [hidden email]> wrote:
> > > >>  >>
> > > >>  >>>  In Haskell you define your functions and its arity.
> > > >>  >>>
> > > >>  >>>  // nullary function
> > > >>  >>>  a :: () => () -> String
> > > >>  >>>  a = "Hello World"
> > > >>  >>>
> > > >>  >>>  // unary function
> > > >>  >>>  b :: (Integral c) => c -: String
> > > >>  >>>  b x = "Hello Integral"
> > > >>  >>>
> > > >>  >>>  I think in Clojure and Scala you can define the arity of the
> > > > function
> > > >>  too.
> > > >>  >>>
> > > >>  >>>  For the users of [functor] I think it would be easier to
> > > > migrate their
> > > >>  >>>  code to Java 8, or use it with Java 8, if both [functor] and
> > > > Java 8
> > > >>  >>>  Function classes had similar behaviour. That would be
> > > > interesting
> > > >>  >>>  especially if the lambda project provided a backport jar.
> > > >>  >>>
> > > >>  >>>  [functor] and lambda project provide 1 and 2 arities by
> > > > default, but
> > > >>  >>>  lambda doesn't provide nullary interfaces (or at least I
> > > > couldn't
> > > >>  >> find them
> > > >>  >>>  in java.util.functions).
> > > >>  >>>
> > > >>  >>>  Cheers
> > > >>  >>>
> > > >>  >>>  Bruno P. Kinoshita
> > > >>  >>>  http://kinoshita.eti.br
> > > >>  >>>  http://tupilabs.com
> > > >>  >>>
> > > >>  >>>
> > > >>  >>>  ----- Original Message -----
> > > >>  >>>  > From: Matt Benson <[hidden email]>
> > > >>  >>>  > To: Commons Developers List
> > > > <[hidden email]>; Bruno P.
> > > >>  >>>  Kinoshita <[hidden email]>
> > > >>  >>>  > Cc:
> > > >>  >>>  > Sent: Tuesday, January 29, 2013 8:57 PM
> > > >>  >>>  > Subject: Re: [functor] Change default arity of Function,
> > > > Predicate
> > > >>  and
> > > >>  >>>  Procedure
> > > >>  >>>  >
> > > >>  >>>  > What about in pure functional languages e.g. Haskell?
> > > >>  >>>  >
> > > >>  >>>  > Matt
> > > >>  >>>  >
> > > >>  >>>  >
> > > >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
> > > >>  >>>  > [hidden email]> wrote:
> > > >>  >>>  >
> > > >>  >>>  >>  Hi all,
> > > >>  >>>  >>
> > > >>  >>>  >>  In Java 8 and Guava the default arity of a Function
> > > > is 1, but in
> > > >>  >>>  [functor]
> > > >>  >>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by
> > > > default a
> > > >>  >>>  UnaryFunction,
> > > >>  >>>  >>  while in [functor] it is a NullaryFunction.
> > > >>  >>>  >>
> > > >>  >>>  >>  What do you guys think of changing the default
> > > > arity of Function,
> > > >>  >>>  >>  Procedure and Predicate in [functor] to 1, rather
> > > > than 0?
> > > >>  >>>  >>
> > > >>  >>>  >>  Cheers
> > > >>  >>>  >>
> > > >>  >>>  >>  Bruno P. Kinoshita
> > > >>  >>>  >>  http://kinoshita.eti.br
> > > >>  >>>  >>  http://tupilabs.com
> > > >>  >>>  >>
> > > >>  >>>  >>
> > > >>  >>
> > > > ---------------------------------------------------------------------
> > > >>  >>>  >>  To unsubscribe, e-mail:
> > > > [hidden email]
> > > >>  >>>  >>  For additional commands, e-mail:
> > > > [hidden email]
> > > >>  >>>  >>
> > > >>  >>>  >>
> > > >>  >>>  >
> > > >>  >>>
> > > >>  >>
> > > >>  >
> > > >>
> >  >---------------------------------------------------------------------
> > > >>  >To unsubscribe, e-mail: [hidden email]
> > > >>  >For additional commands, e-mail: [hidden email]
> > > >>  >
> > > >>  >
> > > >>  >
> > > >>  >
> > > >>
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> >
> > --
> > http://people.apache.org/~britter/
> > http://www.systemoutprintln.de/
> > http://twitter.com/BenediktRitter
> > http://github.com/britter
> >
>



--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Bruno P. Kinoshita-2
Hi Benedikt, 

Thanks for taking a look at the github repo and for posting your thoughts here. 

If I understand it correctly, your concern is: 

- In the github repo, a BinaryFunction is a Binary, and a Binary is an Arity. 

- But at same time, it is intuitive that a BinaryFunction "has" an arity, which is binary. 

Is that right? If so, I think it's a question of changing the nomenclature. The issue started because in functional languages like Haskell, a functor has a broader meaning (e.g.: a list is a functor in Haskell [1]).

Maybe we could revert this changes, or find a better name? I thought about something like Operation or Operator, but in project lambda, the interface BinaryOperator extends BiFunction [2]. So maybe it would be confusing too, if the user was used to Java 8 (assuming both interfaces are released with Java 8).

What do you think? Back to Functors (and maybe document the difference from haskell and [functor]?), or do you have some other name in mind? Academics papers might be a good place to find a better name.

Thanks!!

[1] http://en.wikibooks.org/wiki/Haskell/Applicative_Functors
[2] http://download.java.net/lambda/b76/docs/api/java/util/function/BinaryOperator.html
 
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


----- Original Message -----

> From: Benedikt Ritter <[hidden email]>
> To: Commons Developers List <[hidden email]>
> Cc:
> Sent: Tuesday, February 12, 2013 2:45 PM
> Subject: Re: [functor] Change default arity of Function, Predicate and Procedure
>
> Hi Matt,
>
> 2013/2/12 Matt Benson <[hidden email]>
>
>>  Hi Benedikt,
>>    So what you are pointing out is the "is a" vs. "has
> a" dichotomy?  To an
>>  extent, I see your point.  I could argue that the semantics of the word
>>  "implements" perhaps leaves a bit of so-called wiggle room on the
> is a/has
>>  a subject.
>
>
> Now we are mixing things up. I was referring to the inheritance
> relationships between the interfaces.
>
> The java "implements" keyword is a different concept. Indeed, I'm
> not sure
> if it (or the notion of Interfaces) is part of the OO paradigm at all.
> There is an interesting paper about this topic (what are the core conecpts
> of object orientation?) [1]...
>
> Anyway the reason I'm bringing this rather academic topic up is, that I
> believe that a clear object-orient design will lead to a better (= easier
> to understand) API. People will work with the API. They will browse the
> type hierarchy to understand how things are tied together.
> This will lead to situations like: "okay, I have a BinaryFunction... what
> is a BinaryFuncation? Ah, it's a Binary... what is a Binary? A Binary seems
> to be an Arity... wait.. what?"
>
> Maybe I can make myself clearer by giving a less abstract example.
> Consider the following set of thinks: Cars, Trucks, Motorcycles.
> They all have wheels of some sort. How would you model this using
> Interfaces?
> I'm sure you wouldn't define an interface "Wheel" that is
> extended by Car,
> Truck and Motorcycle.
> Instead you would probably define "Vehicle" with a
> "getNumberOfWheels()"
> method and let Car, Truck and Motorcycle extend Vehicle.
> This is what I meant when I said "Arity is not a superset of
> functors". it
> is a property, like the number of Wheels is a property of all vehicles.
>
> Again, this is all very academic. If you see it fit to create Arity and
> have the different functors extend it, then do it :-)
>
>
>>  This could devolve into a long discussion of the most
>>  semantically correct place to use "implements Arity*" vs.
> "extends Arity*"
>>  throughout the API, but the final result, IMO, is that the intent of any
>>  given concrete class is clear enough, and Arity|Nullary|Unary|Binary|ad
>>  infinitum seems more convenient than e.g.
> "SomethingThatHasArity", etc.
>>
>
> I agree!
>
>
>>
>>  Does that make sense?
>>
>
> As I said, I think pragmatism should win over OO purism :)
>
>
>>
>>  Matt
>>
>
> Benedikt
>
> [1] http://dl.acm.org/citation.cfm?id=1113040
>
>>
>>
>>  On Tue, Feb 12, 2013 at 7:29 AM, Benedikt Ritter <[hidden email]>
>>  wrote:
>>
>>  > Hi Guys,
>>  >
>>  > I've had a look at the github repo and let me say at first that
> I'm no
>>  > expert in functional programming. So maybe what I'm talking is
> complete
>>  > nonsense :)
>>  >
>>  > From what I learned about the concept of arity at wikipedia it seems
> that
>>  > an arity is a property of a functor.
>>  > One could say: "A binary functor has an arity of two"
> (right?!)
>>  >
>>  > In the github repo you introduced an inheritance relationship between
>>  > functors and arity.
>>  > This maybe a good thing to do from a pracmatic POV because all
> functors
>>  > share the fact that say have an arity.
>>  >
>>  > From an object oriented POV inheritance is more then pure reuse. When
>>  > defining an inheritance relationship between concept Super and concept
>>  Sub
>>  > we basically say "Every instance of Sub is also an instance of
> Super" or
>>  > short "Every Sub is also a Super"
>>  >
>>  > Now coming back to functors you have introduced a relationship that
> says
>>  > "Every BinaryFunction is a Binary and every Binary is an
> Arity".
>>  > Keeping in mind that arity is only a property of a functor (rather
> than a
>>  > superset) this seems strange (from an OO POV).
>>  > But as I'm no expert on functional programming this maybe the
> right thing
>>  > to do... :)
>>  >
>>  > just my 2 cents :)
>>  > Benedikt
>>  >
>>  >
>>  >
>>  > 2013/2/11 Bruno P. Kinoshita <[hidden email]>
>>  >
>>  > > Hi Matt!
>>  > >
>>  > > Great! I'll commit these changes tomorrow if there are no
> objections.
>>  > >
>>  > > Thanks!
>>  > >
>>  > > Bruno P. Kinoshita
>>  > > http://kinoshita.eti.br
>>  > > http://tupilabs.com
>>  > >
>>  > >
>>  > > ----- Original Message -----
>>  > > > From: Matt Benson <[hidden email]>
>>  > > > To: Commons Developers List <[hidden email]>
>>  > > > Cc:
>>  > > > Sent: Monday, February 11, 2013 8:39 PM
>>  > > > Subject: Re: [functor] Change default arity of Function,
> Predicate
>>  and
>>  > > Procedure
>>  > > >
>>  > > > Hi Bruno,
>>  > > >   No objections here about the Arity interfaces.  I see that
> your
>>  > master
>>  > > > branch also contains changes to migrate Unary* to * and * to
>>  Nullary*.
>>  > > > Personally I am satisfied to align with lambda/guava if
> noone else
>>  > > objects.
>>  > > >
>>  > > > Thanks,
>>  > > > Matt
>>  > > >
>>  > > >
>>  > > > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
>>  > > > [hidden email]> wrote:
>>  > > >
>>  > > >>  Hi Matt, all,
>>  > > >>
>>  > > >>  I'm messing with [functor] in my GitHub mirror [1].
> You can find
>>  the
>>  > > >>  commits in the master branch [2].
>>  > > >>
>>  > > >>  The Arity->Unary/Binary/Nullary interfaces look
> good. If there are
>>  no
>>  > > >>  objections I would like to commit this change to the
> trunk in SVN.
>>  > > >>
>>  > > >>  There are other changes that I'll omit in this
> commit, but will
>>  start
>>  > > > new
>>  > > >>  threads here in the mailing list :o)
>>  > > >>
>>  > > >>  Thank you in advance!
>>  > > >>
>>  > > >>  [1] https://github.com/kinow/functor
>>  > > >>  [2] https://github.com/kinow/functor/commits/master
>>  > > >>
>>  > > >>  Bruno P. Kinoshita
>>  > > >>  http://kinoshita.eti.br
>>  > > >>  http://tupilabs.com
>>  > > >>
>>  > > >>
>>  > > >>  >________________________________
>>  > > >>  > From: Bruno P. Kinoshita <[hidden email]>
>>  > > >>  >To: Commons Developers List
> <[hidden email]>; "
>>  > > >>  [hidden email]" <[hidden email]>
>>  > > >>  >Sent: Wednesday, January 30, 2013 3:58 PM
>>  > > >>  >Subject: Re: [functor] Change default arity of
> Function, Predicate
>>  > and
>>  > > >>  Procedure
>>  > > >>  >
>>  > > >>  >I think it makes sense and is clear what is does.
>>  > > >>  >
>>  > > >>  >I thought in using {arity}Operation, but in Java 8
> there are
>>  > > interfaces
>>  > > >>  like BinaryOperator, and BinaryOperator extends
> BiFunction, so it
>>  > > would be
>>  > > >>  confusing to users having something like interface
> BinaryFunction
>>  > > extends
>>  > > >>  BinaryOperation in [functor].
>>  > > >>  >
>>  > > >>  >Bruno P. Kinoshita
>>  > > >>  >http://kinoshita.eti.br
>>  > > >>  >http://tupilabs.com
>>  > > >>  >
>>  > > >>  >
>>  > > >>  >----- Original Message -----
>>  > > >>  >> From: Matt Benson <[hidden email]>
>>  > > >>  >> To: Bruno P. Kinoshita
> <[hidden email]>
>>  > > >>  >> Cc: Commons Developers List
> <[hidden email]>
>>  > > >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
>>  > > >>  >> Subject: Re: [functor] Change default arity of
> Function,
>>  Predicate
>>  > > > and
>>  > > >>  Procedure
>>  > > >>  >>
>>  > > >>  >> What about:
>>  > > >>  >>
>>  > > >>  >> Arity (Marker)
>>  > > >>  >> |_Nullary extends Arity
>>  > > >>  >> |_Unary<A> extends Arity
>>  > > >>  >> |_Binary<L, R> extends Arity
>>  > > >>  >>
>>  > > >>  >> ?
>>  > > >>  >>
>>  > > >>  >> Matt
>>  > > >>  >>
>>  > > >>  >>
>>  > > >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P.
> Kinoshita <
>>  > > >>  >> [hidden email]> wrote:
>>  > > >>  >>
>>  > > >>  >>>  In Haskell you define your functions and
> its arity.
>>  > > >>  >>>
>>  > > >>  >>>  // nullary function
>>  > > >>  >>>  a :: () => () -> String
>>  > > >>  >>>  a = "Hello World"
>>  > > >>  >>>
>>  > > >>  >>>  // unary function
>>  > > >>  >>>  b :: (Integral c) => c -: String
>>  > > >>  >>>  b x = "Hello Integral"
>>  > > >>  >>>
>>  > > >>  >>>  I think in Clojure and Scala you can
> define the arity of the
>>  > > > function
>>  > > >>  too.
>>  > > >>  >>>
>>  > > >>  >>>  For the users of [functor] I think it
> would be easier to
>>  > > > migrate their
>>  > > >>  >>>  code to Java 8, or use it with Java 8, if
> both [functor] and
>>  > > > Java 8
>>  > > >>  >>>  Function classes had similar behaviour.
> That would be
>>  > > > interesting
>>  > > >>  >>>  especially if the lambda project provided
> a backport jar.
>>  > > >>  >>>
>>  > > >>  >>>  [functor] and lambda project provide 1
> and 2 arities by
>>  > > > default, but
>>  > > >>  >>>  lambda doesn't provide nullary
> interfaces (or at least I
>>  > > > couldn't
>>  > > >>  >> find them
>>  > > >>  >>>  in java.util.functions).
>>  > > >>  >>>
>>  > > >>  >>>  Cheers
>>  > > >>  >>>
>>  > > >>  >>>  Bruno P. Kinoshita
>>  > > >>  >>>  http://kinoshita.eti.br
>>  > > >>  >>>  http://tupilabs.com
>>  > > >>  >>>
>>  > > >>  >>>
>>  > > >>  >>>  ----- Original Message -----
>>  > > >>  >>>  > From: Matt Benson
> <[hidden email]>
>>  > > >>  >>>  > To: Commons Developers List
>>  > > > <[hidden email]>; Bruno P.
>>  > > >>  >>>  Kinoshita
> <[hidden email]>
>>  > > >>  >>>  > Cc:
>>  > > >>  >>>  > Sent: Tuesday, January 29, 2013 8:57
> PM
>>  > > >>  >>>  > Subject: Re: [functor] Change
> default arity of Function,
>>  > > > Predicate
>>  > > >>  and
>>  > > >>  >>>  Procedure
>>  > > >>  >>>  >
>>  > > >>  >>>  > What about in pure functional
> languages e.g. Haskell?
>>  > > >>  >>>  >
>>  > > >>  >>>  > Matt
>>  > > >>  >>>  >
>>  > > >>  >>>  >
>>  > > >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM,
> Bruno P. Kinoshita <
>>  > > >>  >>>  > [hidden email]>
> wrote:
>>  > > >>  >>>  >
>>  > > >>  >>>  >>  Hi all,
>>  > > >>  >>>  >>
>>  > > >>  >>>  >>  In Java 8 and Guava the default
> arity of a Function
>>  > > > is 1, but in
>>  > > >>  >>>  [functor]
>>  > > >>  >>>  >>  it is 0, IOW, in Java 8 and
> Guava a Function is by
>>  > > > default a
>>  > > >>  >>>  UnaryFunction,
>>  > > >>  >>>  >>  while in [functor] it is a
> NullaryFunction.
>>  > > >>  >>>  >>
>>  > > >>  >>>  >>  What do you guys think of
> changing the default
>>  > > > arity of Function,
>>  > > >>  >>>  >>  Procedure and Predicate in
> [functor] to 1, rather
>>  > > > than 0?
>>  > > >>  >>>  >>
>>  > > >>  >>>  >>  Cheers
>>  > > >>  >>>  >>
>>  > > >>  >>>  >>  Bruno P. Kinoshita
>>  > > >>  >>>  >>  http://kinoshita.eti.br
>>  > > >>  >>>  >>  http://tupilabs.com
>>  > > >>  >>>  >>
>>  > > >>  >>>  >>
>>  > > >>  >>
>>  > > >
> ---------------------------------------------------------------------
>>  > > >>  >>>  >>  To unsubscribe, e-mail:
>>  > > > [hidden email]
>>  > > >>  >>>  >>  For additional commands,
> e-mail:
>>  > > > [hidden email]
>>  > > >>  >>>  >>
>>  > > >>  >>>  >>
>>  > > >>  >>>  >
>>  > > >>  >>>
>>  > > >>  >>
>>  > > >>  >
>>  > > >>
>>  > 
>> ---------------------------------------------------------------------
>>  > > >>  >To unsubscribe, e-mail:
> [hidden email]
>>  > > >>  >For additional commands, e-mail:
> [hidden email]
>>  > > >>  >
>>  > > >>  >
>>  > > >>  >
>>  > > >>  >
>>  > > >>
>>  > > >
>>  > >
>>  > >
> ---------------------------------------------------------------------
>>  > > To unsubscribe, e-mail: [hidden email]
>>  > > For additional commands, e-mail: [hidden email]
>>  > >
>>  > >
>>  >
>>  >
>>  > --
>>  > http://people.apache.org/~britter/
>>  > http://www.systemoutprintln.de/
>>  > http://twitter.com/BenediktRitter
>>  > http://github.com/britter
>>  >
>>
>
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Bruno P. Kinoshita-2
In reply to this post by Matt Benson-2
Hi Matt!

I changed the default arity with Eclipse help. After a quick glimpse everything looked fine in the api module. But in core module,  the packages oacf.adapter and oacf.composite  have classes like And and UnaryAnd, that could be updated to NullaryAnd and And, or NullaryAnd and UnaryAnd.

The {@link } in javadoc helped a lot too. 

But this change would affect a lot of other classes in core module (I think over 100 classes and test-classes). I think it would be easier to merge the generators branches without this change, so perhaps we could postpone it for now until we resolve FUNCTOR-14 [1] and merge the branches with the trunk. 

What do you think?

I've created FUNCTOR-24 [2] for this issue.

Thank you in advance,

[1] https://issues.apache.org/jira/browse/FUNCTOR-14
[2] https://issues.apache.org/jira/browse/FUNCTOR-24
 
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


----- Original Message -----

> From: Matt Benson <[hidden email]>
> To: Commons Developers List <[hidden email]>
> Cc:
> Sent: Monday, February 11, 2013 8:39 PM
> Subject: Re: [functor] Change default arity of Function, Predicate and Procedure
>
> Hi Bruno,
>   No objections here about the Arity interfaces.  I see that your master
> branch also contains changes to migrate Unary* to * and * to Nullary*.
> Personally I am satisfied to align with lambda/guava if noone else objects.
>
> Thanks,
> Matt
>
>
> On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> [hidden email]> wrote:
>
>>  Hi Matt, all,
>>
>>  I'm messing with [functor] in my GitHub mirror [1]. You can find the
>>  commits in the master branch [2].
>>
>>  The Arity->Unary/Binary/Nullary interfaces look good. If there are no
>>  objections I would like to commit this change to the trunk in SVN.
>>
>>  There are other changes that I'll omit in this commit, but will start
> new
>>  threads here in the mailing list :o)
>>
>>  Thank you in advance!
>>
>>  [1] https://github.com/kinow/functor
>>  [2] https://github.com/kinow/functor/commits/master
>>
>>  Bruno P. Kinoshita
>>  http://kinoshita.eti.br
>>  http://tupilabs.com
>>
>>
>>  >________________________________
>>  > From: Bruno P. Kinoshita <[hidden email]>
>>  >To: Commons Developers List <[hidden email]>; "
>>  [hidden email]" <[hidden email]>
>>  >Sent: Wednesday, January 30, 2013 3:58 PM
>>  >Subject: Re: [functor] Change default arity of Function, Predicate and
>>  Procedure
>>  >
>>  >I think it makes sense and is clear what is does.
>>  >
>>  >I thought in using {arity}Operation, but in Java 8 there are interfaces
>>  like BinaryOperator, and BinaryOperator extends BiFunction, so it would be
>>  confusing to users having something like interface BinaryFunction extends
>>  BinaryOperation in [functor].
>>  >
>>  >Bruno P. Kinoshita
>>  >http://kinoshita.eti.br
>>  >http://tupilabs.com
>>  >
>>  >
>>  >----- Original Message -----
>>  >> From: Matt Benson <[hidden email]>
>>  >> To: Bruno P. Kinoshita <[hidden email]>
>>  >> Cc: Commons Developers List <[hidden email]>
>>  >> Sent: Wednesday, January 30, 2013 1:29 PM
>>  >> Subject: Re: [functor] Change default arity of Function, Predicate
> and
>>  Procedure
>>  >>
>>  >> What about:
>>  >>
>>  >> Arity (Marker)
>>  >> |_Nullary extends Arity
>>  >> |_Unary<A> extends Arity
>>  >> |_Binary<L, R> extends Arity
>>  >>
>>  >> ?
>>  >>
>>  >> Matt
>>  >>
>>  >>
>>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
>>  >> [hidden email]> wrote:
>>  >>
>>  >>>  In Haskell you define your functions and its arity.
>>  >>>
>>  >>>  // nullary function
>>  >>>  a :: () => () -> String
>>  >>>  a = "Hello World"
>>  >>>
>>  >>>  // unary function
>>  >>>  b :: (Integral c) => c -: String
>>  >>>  b x = "Hello Integral"
>>  >>>
>>  >>>  I think in Clojure and Scala you can define the arity of the
> function
>>  too.
>>  >>>
>>  >>>  For the users of [functor] I think it would be easier to
> migrate their
>>  >>>  code to Java 8, or use it with Java 8, if both [functor] and
> Java 8
>>  >>>  Function classes had similar behaviour. That would be
> interesting
>>  >>>  especially if the lambda project provided a backport jar.
>>  >>>
>>  >>>  [functor] and lambda project provide 1 and 2 arities by
> default, but
>>  >>>  lambda doesn't provide nullary interfaces (or at least I
> couldn't
>>  >> find them
>>  >>>  in java.util.functions).
>>  >>>
>>  >>>  Cheers
>>  >>>
>>  >>>  Bruno P. Kinoshita
>>  >>>  http://kinoshita.eti.br
>>  >>>  http://tupilabs.com
>>  >>>
>>  >>>
>>  >>>  ----- Original Message -----
>>  >>>  > From: Matt Benson <[hidden email]>
>>  >>>  > To: Commons Developers List
> <[hidden email]>; Bruno P.
>>  >>>  Kinoshita <[hidden email]>
>>  >>>  > Cc:
>>  >>>  > Sent: Tuesday, January 29, 2013 8:57 PM
>>  >>>  > Subject: Re: [functor] Change default arity of Function,
> Predicate
>>  and
>>  >>>  Procedure
>>  >>>  >
>>  >>>  > What about in pure functional languages e.g. Haskell?
>>  >>>  >
>>  >>>  > Matt
>>  >>>  >
>>  >>>  >
>>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
>>  >>>  > [hidden email]> wrote:
>>  >>>  >
>>  >>>  >>  Hi all,
>>  >>>  >>
>>  >>>  >>  In Java 8 and Guava the default arity of a Function
> is 1, but in
>>  >>>  [functor]
>>  >>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by
> default a
>>  >>>  UnaryFunction,
>>  >>>  >>  while in [functor] it is a NullaryFunction.
>>  >>>  >>
>>  >>>  >>  What do you guys think of changing the default
> arity of Function,
>>  >>>  >>  Procedure and Predicate in [functor] to 1, rather
> than 0?
>>  >>>  >>
>>  >>>  >>  Cheers
>>  >>>  >>
>>  >>>  >>  Bruno P. Kinoshita
>>  >>>  >>  http://kinoshita.eti.br
>>  >>>  >>  http://tupilabs.com
>>  >>>  >>
>>  >>>  >>
>>  >>
> ---------------------------------------------------------------------
>>  >>>  >>  To unsubscribe, e-mail:
> [hidden email]
>>  >>>  >>  For additional commands, e-mail:
> [hidden email]
>>  >>>  >>
>>  >>>  >>
>>  >>>  >
>>  >>>
>>  >>
>>  >
>>  >---------------------------------------------------------------------
>>  >To unsubscribe, e-mail: [hidden email]
>>  >For additional commands, e-mail: [hidden email]
>>  >
>>  >
>>  >
>>  >
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Matt Benson-2
Sounds reasonable, I agree.

Matt


On Tue, Feb 12, 2013 at 3:49 PM, Bruno P. Kinoshita <[hidden email]>wrote:

> Hi Matt!
>
> I changed the default arity with Eclipse help. After a quick glimpse
> everything looked fine in the api module. But in core module,  the packages
> oacf.adapter and oacf.composite  have classes like And and UnaryAnd, that
> could be updated to NullaryAnd and And, or NullaryAnd and UnaryAnd.
>
> The {@link } in javadoc helped a lot too.
>
> But this change would affect a lot of other classes in core module (I
> think over 100 classes and test-classes). I think it would be easier to
> merge the generators branches without this change, so perhaps we could
> postpone it for now until we resolve FUNCTOR-14 [1] and merge the branches
> with the trunk.
>
> What do you think?
>
> I've created FUNCTOR-24 [2] for this issue.
>
> Thank you in advance,
>
> [1] https://issues.apache.org/jira/browse/FUNCTOR-14
> [2] https://issues.apache.org/jira/browse/FUNCTOR-24
>
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
>
> ----- Original Message -----
> > From: Matt Benson <[hidden email]>
> > To: Commons Developers List <[hidden email]>
> > Cc:
> > Sent: Monday, February 11, 2013 8:39 PM
> > Subject: Re: [functor] Change default arity of Function, Predicate and
> Procedure
> >
> > Hi Bruno,
> >   No objections here about the Arity interfaces.  I see that your master
> > branch also contains changes to migrate Unary* to * and * to Nullary*.
> > Personally I am satisfied to align with lambda/guava if noone else
> objects.
> >
> > Thanks,
> > Matt
> >
> >
> > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> > [hidden email]> wrote:
> >
> >>  Hi Matt, all,
> >>
> >>  I'm messing with [functor] in my GitHub mirror [1]. You can find the
> >>  commits in the master branch [2].
> >>
> >>  The Arity->Unary/Binary/Nullary interfaces look good. If there are no
> >>  objections I would like to commit this change to the trunk in SVN.
> >>
> >>  There are other changes that I'll omit in this commit, but will start
> > new
> >>  threads here in the mailing list :o)
> >>
> >>  Thank you in advance!
> >>
> >>  [1] https://github.com/kinow/functor
> >>  [2] https://github.com/kinow/functor/commits/master
> >>
> >>  Bruno P. Kinoshita
> >>  http://kinoshita.eti.br
> >>  http://tupilabs.com
> >>
> >>
> >>  >________________________________
> >>  > From: Bruno P. Kinoshita <[hidden email]>
> >>  >To: Commons Developers List <[hidden email]>; "
> >>  [hidden email]" <[hidden email]>
> >>  >Sent: Wednesday, January 30, 2013 3:58 PM
> >>  >Subject: Re: [functor] Change default arity of Function, Predicate and
> >>  Procedure
> >>  >
> >>  >I think it makes sense and is clear what is does.
> >>  >
> >>  >I thought in using {arity}Operation, but in Java 8 there are
> interfaces
> >>  like BinaryOperator, and BinaryOperator extends BiFunction, so it
> would be
> >>  confusing to users having something like interface BinaryFunction
> extends
> >>  BinaryOperation in [functor].
> >>  >
> >>  >Bruno P. Kinoshita
> >>  >http://kinoshita.eti.br
> >>  >http://tupilabs.com
> >>  >
> >>  >
> >>  >----- Original Message -----
> >>  >> From: Matt Benson <[hidden email]>
> >>  >> To: Bruno P. Kinoshita <[hidden email]>
> >>  >> Cc: Commons Developers List <[hidden email]>
> >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
> >>  >> Subject: Re: [functor] Change default arity of Function, Predicate
> > and
> >>  Procedure
> >>  >>
> >>  >> What about:
> >>  >>
> >>  >> Arity (Marker)
> >>  >> |_Nullary extends Arity
> >>  >> |_Unary<A> extends Arity
> >>  >> |_Binary<L, R> extends Arity
> >>  >>
> >>  >> ?
> >>  >>
> >>  >> Matt
> >>  >>
> >>  >>
> >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P. Kinoshita <
> >>  >> [hidden email]> wrote:
> >>  >>
> >>  >>>  In Haskell you define your functions and its arity.
> >>  >>>
> >>  >>>  // nullary function
> >>  >>>  a :: () => () -> String
> >>  >>>  a = "Hello World"
> >>  >>>
> >>  >>>  // unary function
> >>  >>>  b :: (Integral c) => c -: String
> >>  >>>  b x = "Hello Integral"
> >>  >>>
> >>  >>>  I think in Clojure and Scala you can define the arity of the
> > function
> >>  too.
> >>  >>>
> >>  >>>  For the users of [functor] I think it would be easier to
> > migrate their
> >>  >>>  code to Java 8, or use it with Java 8, if both [functor] and
> > Java 8
> >>  >>>  Function classes had similar behaviour. That would be
> > interesting
> >>  >>>  especially if the lambda project provided a backport jar.
> >>  >>>
> >>  >>>  [functor] and lambda project provide 1 and 2 arities by
> > default, but
> >>  >>>  lambda doesn't provide nullary interfaces (or at least I
> > couldn't
> >>  >> find them
> >>  >>>  in java.util.functions).
> >>  >>>
> >>  >>>  Cheers
> >>  >>>
> >>  >>>  Bruno P. Kinoshita
> >>  >>>  http://kinoshita.eti.br
> >>  >>>  http://tupilabs.com
> >>  >>>
> >>  >>>
> >>  >>>  ----- Original Message -----
> >>  >>>  > From: Matt Benson <[hidden email]>
> >>  >>>  > To: Commons Developers List
> > <[hidden email]>; Bruno P.
> >>  >>>  Kinoshita <[hidden email]>
> >>  >>>  > Cc:
> >>  >>>  > Sent: Tuesday, January 29, 2013 8:57 PM
> >>  >>>  > Subject: Re: [functor] Change default arity of Function,
> > Predicate
> >>  and
> >>  >>>  Procedure
> >>  >>>  >
> >>  >>>  > What about in pure functional languages e.g. Haskell?
> >>  >>>  >
> >>  >>>  > Matt
> >>  >>>  >
> >>  >>>  >
> >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM, Bruno P. Kinoshita <
> >>  >>>  > [hidden email]> wrote:
> >>  >>>  >
> >>  >>>  >>  Hi all,
> >>  >>>  >>
> >>  >>>  >>  In Java 8 and Guava the default arity of a Function
> > is 1, but in
> >>  >>>  [functor]
> >>  >>>  >>  it is 0, IOW, in Java 8 and Guava a Function is by
> > default a
> >>  >>>  UnaryFunction,
> >>  >>>  >>  while in [functor] it is a NullaryFunction.
> >>  >>>  >>
> >>  >>>  >>  What do you guys think of changing the default
> > arity of Function,
> >>  >>>  >>  Procedure and Predicate in [functor] to 1, rather
> > than 0?
> >>  >>>  >>
> >>  >>>  >>  Cheers
> >>  >>>  >>
> >>  >>>  >>  Bruno P. Kinoshita
> >>  >>>  >>  http://kinoshita.eti.br
> >>  >>>  >>  http://tupilabs.com
> >>  >>>  >>
> >>  >>>  >>
> >>  >>
> > ---------------------------------------------------------------------
> >>  >>>  >>  To unsubscribe, e-mail:
> > [hidden email]
> >>  >>>  >>  For additional commands, e-mail:
> > [hidden email]
> >>  >>>  >>
> >>  >>>  >>
> >>  >>>  >
> >>  >>>
> >>  >>
> >>  >
> >>  >---------------------------------------------------------------------
> >>  >To unsubscribe, e-mail: [hidden email]
> >>  >For additional commands, e-mail: [hidden email]
> >>  >
> >>  >
> >>  >
> >>  >
> >>
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Benedikt Ritter-4
In reply to this post by Bruno P. Kinoshita-2
Hi Bruno,


2013/2/12 Bruno P. Kinoshita <[hidden email]>

> Hi Benedikt,
>
> Thanks for taking a look at the github repo and for posting your thoughts
> here.
>
> If I understand it correctly, your concern is:
>
> - In the github repo, a BinaryFunction is a Binary, and a Binary is an
> Arity.
>
> - But at same time, it is intuitive that a BinaryFunction "has" an arity,
> which is binary.


> Is that right? If so, I think it's a question of changing the
> nomenclature. The issue started because in functional languages like
> Haskell, a functor has a broader meaning (e.g.: a list is a functor in
> Haskell [1]).
>

Yes, I guess it boils down to this :)
As Matt has pointed out, there does not seem to be a name for the superset
of things that have an arity and "SomethingThatHasArity" really is a bad
name :)


>
> Maybe we could revert this changes, or find a better name? I thought about
> something like Operation or Operator, but in project lambda, the interface
> BinaryOperator extends BiFunction [2]. So maybe it would be confusing too,
> if the user was used to Java 8 (assuming both interfaces are released with
> Java 8).


Yes, this may confuse users. Better prevent collisions with core java
terminology.


> What do you think? Back to Functors (and maybe document the difference
> from haskell and [functor]?), or do you have some other name in mind?
> Academics papers might be a good place to find a better name.
>

Sorry, as I'm no expert on functional programming I don't know the
terminology in that domain. The question is, what is the superset of
Predicates, Functions and Procedures (those are the concepts in [functor]
that have an arity, right?).

This superset seems to be "functor". I haven't understood yet, why you
think it is a bad name.

Again: If it practical to just call it Arity, then you should go ahead
(pragmatism wins over oo purism ;-)

Benedikt


>
> Thanks!!
>
> [1] http://en.wikibooks.org/wiki/Haskell/Applicative_Functors
> [2]
> http://download.java.net/lambda/b76/docs/api/java/util/function/BinaryOperator.html
>
> Bruno P. Kinoshita
> http://kinoshita.eti.br
> http://tupilabs.com
>
>
> ----- Original Message -----
> > From: Benedikt Ritter <[hidden email]>
> > To: Commons Developers List <[hidden email]>
> > Cc:
> > Sent: Tuesday, February 12, 2013 2:45 PM
> > Subject: Re: [functor] Change default arity of Function, Predicate and
> Procedure
> >
> > Hi Matt,
> >
> > 2013/2/12 Matt Benson <[hidden email]>
> >
> >>  Hi Benedikt,
> >>    So what you are pointing out is the "is a" vs. "has
> > a" dichotomy?  To an
> >>  extent, I see your point.  I could argue that the semantics of the word
> >>  "implements" perhaps leaves a bit of so-called wiggle room on the
> > is a/has
> >>  a subject.
> >
> >
> > Now we are mixing things up. I was referring to the inheritance
> > relationships between the interfaces.
> >
> > The java "implements" keyword is a different concept. Indeed, I'm
> > not sure
> > if it (or the notion of Interfaces) is part of the OO paradigm at all.
> > There is an interesting paper about this topic (what are the core
> conecpts
> > of object orientation?) [1]...
> >
> > Anyway the reason I'm bringing this rather academic topic up is, that I
> > believe that a clear object-orient design will lead to a better (= easier
> > to understand) API. People will work with the API. They will browse the
> > type hierarchy to understand how things are tied together.
> > This will lead to situations like: "okay, I have a BinaryFunction... what
> > is a BinaryFuncation? Ah, it's a Binary... what is a Binary? A Binary
> seems
> > to be an Arity... wait.. what?"
> >
> > Maybe I can make myself clearer by giving a less abstract example.
> > Consider the following set of thinks: Cars, Trucks, Motorcycles.
> > They all have wheels of some sort. How would you model this using
> > Interfaces?
> > I'm sure you wouldn't define an interface "Wheel" that is
> > extended by Car,
> > Truck and Motorcycle.
> > Instead you would probably define "Vehicle" with a
> > "getNumberOfWheels()"
> > method and let Car, Truck and Motorcycle extend Vehicle.
> > This is what I meant when I said "Arity is not a superset of
> > functors". it
> > is a property, like the number of Wheels is a property of all vehicles.
> >
> > Again, this is all very academic. If you see it fit to create Arity and
> > have the different functors extend it, then do it :-)
> >
> >
> >>  This could devolve into a long discussion of the most
> >>  semantically correct place to use "implements Arity*" vs.
> > "extends Arity*"
> >>  throughout the API, but the final result, IMO, is that the intent of
> any
> >>  given concrete class is clear enough, and Arity|Nullary|Unary|Binary|ad
> >>  infinitum seems more convenient than e.g.
> > "SomethingThatHasArity", etc.
> >>
> >
> > I agree!
> >
> >
> >>
> >>  Does that make sense?
> >>
> >
> > As I said, I think pragmatism should win over OO purism :)
> >
> >
> >>
> >>  Matt
> >>
> >
> > Benedikt
> >
> > [1] http://dl.acm.org/citation.cfm?id=1113040
> >
> >>
> >>
> >>  On Tue, Feb 12, 2013 at 7:29 AM, Benedikt Ritter <[hidden email]>
> >>  wrote:
> >>
> >>  > Hi Guys,
> >>  >
> >>  > I've had a look at the github repo and let me say at first that
> > I'm no
> >>  > expert in functional programming. So maybe what I'm talking is
> > complete
> >>  > nonsense :)
> >>  >
> >>  > From what I learned about the concept of arity at wikipedia it seems
> > that
> >>  > an arity is a property of a functor.
> >>  > One could say: "A binary functor has an arity of two"
> > (right?!)
> >>  >
> >>  > In the github repo you introduced an inheritance relationship between
> >>  > functors and arity.
> >>  > This maybe a good thing to do from a pracmatic POV because all
> > functors
> >>  > share the fact that say have an arity.
> >>  >
> >>  > From an object oriented POV inheritance is more then pure reuse. When
> >>  > defining an inheritance relationship between concept Super and
> concept
> >>  Sub
> >>  > we basically say "Every instance of Sub is also an instance of
> > Super" or
> >>  > short "Every Sub is also a Super"
> >>  >
> >>  > Now coming back to functors you have introduced a relationship that
> > says
> >>  > "Every BinaryFunction is a Binary and every Binary is an
> > Arity".
> >>  > Keeping in mind that arity is only a property of a functor (rather
> > than a
> >>  > superset) this seems strange (from an OO POV).
> >>  > But as I'm no expert on functional programming this maybe the
> > right thing
> >>  > to do... :)
> >>  >
> >>  > just my 2 cents :)
> >>  > Benedikt
> >>  >
> >>  >
> >>  >
> >>  > 2013/2/11 Bruno P. Kinoshita <[hidden email]>
> >>  >
> >>  > > Hi Matt!
> >>  > >
> >>  > > Great! I'll commit these changes tomorrow if there are no
> > objections.
> >>  > >
> >>  > > Thanks!
> >>  > >
> >>  > > Bruno P. Kinoshita
> >>  > > http://kinoshita.eti.br
> >>  > > http://tupilabs.com
> >>  > >
> >>  > >
> >>  > > ----- Original Message -----
> >>  > > > From: Matt Benson <[hidden email]>
> >>  > > > To: Commons Developers List <[hidden email]>
> >>  > > > Cc:
> >>  > > > Sent: Monday, February 11, 2013 8:39 PM
> >>  > > > Subject: Re: [functor] Change default arity of Function,
> > Predicate
> >>  and
> >>  > > Procedure
> >>  > > >
> >>  > > > Hi Bruno,
> >>  > > >   No objections here about the Arity interfaces.  I see that
> > your
> >>  > master
> >>  > > > branch also contains changes to migrate Unary* to * and * to
> >>  Nullary*.
> >>  > > > Personally I am satisfied to align with lambda/guava if
> > noone else
> >>  > > objects.
> >>  > > >
> >>  > > > Thanks,
> >>  > > > Matt
> >>  > > >
> >>  > > >
> >>  > > > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> >>  > > > [hidden email]> wrote:
> >>  > > >
> >>  > > >>  Hi Matt, all,
> >>  > > >>
> >>  > > >>  I'm messing with [functor] in my GitHub mirror [1].
> > You can find
> >>  the
> >>  > > >>  commits in the master branch [2].
> >>  > > >>
> >>  > > >>  The Arity->Unary/Binary/Nullary interfaces look
> > good. If there are
> >>  no
> >>  > > >>  objections I would like to commit this change to the
> > trunk in SVN.
> >>  > > >>
> >>  > > >>  There are other changes that I'll omit in this
> > commit, but will
> >>  start
> >>  > > > new
> >>  > > >>  threads here in the mailing list :o)
> >>  > > >>
> >>  > > >>  Thank you in advance!
> >>  > > >>
> >>  > > >>  [1] https://github.com/kinow/functor
> >>  > > >>  [2] https://github.com/kinow/functor/commits/master
> >>  > > >>
> >>  > > >>  Bruno P. Kinoshita
> >>  > > >>  http://kinoshita.eti.br
> >>  > > >>  http://tupilabs.com
> >>  > > >>
> >>  > > >>
> >>  > > >>  >________________________________
> >>  > > >>  > From: Bruno P. Kinoshita <[hidden email]>
> >>  > > >>  >To: Commons Developers List
> > <[hidden email]>; "
> >>  > > >>  [hidden email]" <[hidden email]>
> >>  > > >>  >Sent: Wednesday, January 30, 2013 3:58 PM
> >>  > > >>  >Subject: Re: [functor] Change default arity of
> > Function, Predicate
> >>  > and
> >>  > > >>  Procedure
> >>  > > >>  >
> >>  > > >>  >I think it makes sense and is clear what is does.
> >>  > > >>  >
> >>  > > >>  >I thought in using {arity}Operation, but in Java 8
> > there are
> >>  > > interfaces
> >>  > > >>  like BinaryOperator, and BinaryOperator extends
> > BiFunction, so it
> >>  > > would be
> >>  > > >>  confusing to users having something like interface
> > BinaryFunction
> >>  > > extends
> >>  > > >>  BinaryOperation in [functor].
> >>  > > >>  >
> >>  > > >>  >Bruno P. Kinoshita
> >>  > > >>  >http://kinoshita.eti.br
> >>  > > >>  >http://tupilabs.com
> >>  > > >>  >
> >>  > > >>  >
> >>  > > >>  >----- Original Message -----
> >>  > > >>  >> From: Matt Benson <[hidden email]>
> >>  > > >>  >> To: Bruno P. Kinoshita
> > <[hidden email]>
> >>  > > >>  >> Cc: Commons Developers List
> > <[hidden email]>
> >>  > > >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
> >>  > > >>  >> Subject: Re: [functor] Change default arity of
> > Function,
> >>  Predicate
> >>  > > > and
> >>  > > >>  Procedure
> >>  > > >>  >>
> >>  > > >>  >> What about:
> >>  > > >>  >>
> >>  > > >>  >> Arity (Marker)
> >>  > > >>  >> |_Nullary extends Arity
> >>  > > >>  >> |_Unary<A> extends Arity
> >>  > > >>  >> |_Binary<L, R> extends Arity
> >>  > > >>  >>
> >>  > > >>  >> ?
> >>  > > >>  >>
> >>  > > >>  >> Matt
> >>  > > >>  >>
> >>  > > >>  >>
> >>  > > >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P.
> > Kinoshita <
> >>  > > >>  >> [hidden email]> wrote:
> >>  > > >>  >>
> >>  > > >>  >>>  In Haskell you define your functions and
> > its arity.
> >>  > > >>  >>>
> >>  > > >>  >>>  // nullary function
> >>  > > >>  >>>  a :: () => () -> String
> >>  > > >>  >>>  a = "Hello World"
> >>  > > >>  >>>
> >>  > > >>  >>>  // unary function
> >>  > > >>  >>>  b :: (Integral c) => c -: String
> >>  > > >>  >>>  b x = "Hello Integral"
> >>  > > >>  >>>
> >>  > > >>  >>>  I think in Clojure and Scala you can
> > define the arity of the
> >>  > > > function
> >>  > > >>  too.
> >>  > > >>  >>>
> >>  > > >>  >>>  For the users of [functor] I think it
> > would be easier to
> >>  > > > migrate their
> >>  > > >>  >>>  code to Java 8, or use it with Java 8, if
> > both [functor] and
> >>  > > > Java 8
> >>  > > >>  >>>  Function classes had similar behaviour.
> > That would be
> >>  > > > interesting
> >>  > > >>  >>>  especially if the lambda project provided
> > a backport jar.
> >>  > > >>  >>>
> >>  > > >>  >>>  [functor] and lambda project provide 1
> > and 2 arities by
> >>  > > > default, but
> >>  > > >>  >>>  lambda doesn't provide nullary
> > interfaces (or at least I
> >>  > > > couldn't
> >>  > > >>  >> find them
> >>  > > >>  >>>  in java.util.functions).
> >>  > > >>  >>>
> >>  > > >>  >>>  Cheers
> >>  > > >>  >>>
> >>  > > >>  >>>  Bruno P. Kinoshita
> >>  > > >>  >>>  http://kinoshita.eti.br
> >>  > > >>  >>>  http://tupilabs.com
> >>  > > >>  >>>
> >>  > > >>  >>>
> >>  > > >>  >>>  ----- Original Message -----
> >>  > > >>  >>>  > From: Matt Benson
> > <[hidden email]>
> >>  > > >>  >>>  > To: Commons Developers List
> >>  > > > <[hidden email]>; Bruno P.
> >>  > > >>  >>>  Kinoshita
> > <[hidden email]>
> >>  > > >>  >>>  > Cc:
> >>  > > >>  >>>  > Sent: Tuesday, January 29, 2013 8:57
> > PM
> >>  > > >>  >>>  > Subject: Re: [functor] Change
> > default arity of Function,
> >>  > > > Predicate
> >>  > > >>  and
> >>  > > >>  >>>  Procedure
> >>  > > >>  >>>  >
> >>  > > >>  >>>  > What about in pure functional
> > languages e.g. Haskell?
> >>  > > >>  >>>  >
> >>  > > >>  >>>  > Matt
> >>  > > >>  >>>  >
> >>  > > >>  >>>  >
> >>  > > >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM,
> > Bruno P. Kinoshita <
> >>  > > >>  >>>  > [hidden email]>
> > wrote:
> >>  > > >>  >>>  >
> >>  > > >>  >>>  >>  Hi all,
> >>  > > >>  >>>  >>
> >>  > > >>  >>>  >>  In Java 8 and Guava the default
> > arity of a Function
> >>  > > > is 1, but in
> >>  > > >>  >>>  [functor]
> >>  > > >>  >>>  >>  it is 0, IOW, in Java 8 and
> > Guava a Function is by
> >>  > > > default a
> >>  > > >>  >>>  UnaryFunction,
> >>  > > >>  >>>  >>  while in [functor] it is a
> > NullaryFunction.
> >>  > > >>  >>>  >>
> >>  > > >>  >>>  >>  What do you guys think of
> > changing the default
> >>  > > > arity of Function,
> >>  > > >>  >>>  >>  Procedure and Predicate in
> > [functor] to 1, rather
> >>  > > > than 0?
> >>  > > >>  >>>  >>
> >>  > > >>  >>>  >>  Cheers
> >>  > > >>  >>>  >>
> >>  > > >>  >>>  >>  Bruno P. Kinoshita
> >>  > > >>  >>>  >>  http://kinoshita.eti.br
> >>  > > >>  >>>  >>  http://tupilabs.com
> >>  > > >>  >>>  >>
> >>  > > >>  >>>  >>
> >>  > > >>  >>
> >>  > > >
> > ---------------------------------------------------------------------
> >>  > > >>  >>>  >>  To unsubscribe, e-mail:
> >>  > > > [hidden email]
> >>  > > >>  >>>  >>  For additional commands,
> > e-mail:
> >>  > > > [hidden email]
> >>  > > >>  >>>  >>
> >>  > > >>  >>>  >>
> >>  > > >>  >>>  >
> >>  > > >>  >>>
> >>  > > >>  >>
> >>  > > >>  >
> >>  > > >>
> >>  >
> >> ---------------------------------------------------------------------
> >>  > > >>  >To unsubscribe, e-mail:
> > [hidden email]
> >>  > > >>  >For additional commands, e-mail:
> > [hidden email]
> >>  > > >>  >
> >>  > > >>  >
> >>  > > >>  >
> >>  > > >>  >
> >>  > > >>
> >>  > > >
> >>  > >
> >>  > >
> > ---------------------------------------------------------------------
> >>  > > To unsubscribe, e-mail: [hidden email]
> >>  > > For additional commands, e-mail: [hidden email]
> >>  > >
> >>  > >
> >>  >
> >>  >
> >>  > --
> >>  > http://people.apache.org/~britter/
> >>  > http://www.systemoutprintln.de/
> >>  > http://twitter.com/BenediktRitter
> >>  > http://github.com/britter
> >>  >
> >>
> >
> >
> >
> > --
> > http://people.apache.org/~britter/
> > http://www.systemoutprintln.de/
> > http://twitter.com/BenediktRitter
> > http://github.com/britter
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Matt Benson-2
TBH, I can't recall what the argument was against "Functor" either; I think
it had something to do with potentially confusing users of other libraries?

Functor
|_NullaryFunctor
|_UnaryFunctor
|_BinaryFunctor

*is* the current state.  :)  Now, when I woke up this morning I did so with
another concept floating around in my brain (it may be crazy, or not work):

interface Arity {
}

interface Argumented<A extends Arity> {
}

interface Unary<A> extends Arity {
}

interface UnaryFunction<A, T> extends Argumented<Unary<A>> {
}

Bear in mind the goal is to be able to inspect the type of a functor to
determine its arity (momentarily disregarding the fact that this goal is
seeming less worth the trouble all the while :P ).  This approach would
make that a bit more complex, but still seemingly doable.

Thoughts?

Matt

On Wed, Feb 13, 2013 at 4:50 AM, Benedikt Ritter <[hidden email]> wrote:

> Hi Bruno,
>
>
> 2013/2/12 Bruno P. Kinoshita <[hidden email]>
>
> > Hi Benedikt,
> >
> > Thanks for taking a look at the github repo and for posting your thoughts
> > here.
> >
> > If I understand it correctly, your concern is:
> >
> > - In the github repo, a BinaryFunction is a Binary, and a Binary is an
> > Arity.
> >
> > - But at same time, it is intuitive that a BinaryFunction "has" an arity,
> > which is binary.
>
>
> > Is that right? If so, I think it's a question of changing the
> > nomenclature. The issue started because in functional languages like
> > Haskell, a functor has a broader meaning (e.g.: a list is a functor in
> > Haskell [1]).
> >
>
> Yes, I guess it boils down to this :)
> As Matt has pointed out, there does not seem to be a name for the superset
> of things that have an arity and "SomethingThatHasArity" really is a bad
> name :)
>
>
> >
> > Maybe we could revert this changes, or find a better name? I thought
> about
> > something like Operation or Operator, but in project lambda, the
> interface
> > BinaryOperator extends BiFunction [2]. So maybe it would be confusing
> too,
> > if the user was used to Java 8 (assuming both interfaces are released
> with
> > Java 8).
>
>
> Yes, this may confuse users. Better prevent collisions with core java
> terminology.
>
>
> > What do you think? Back to Functors (and maybe document the difference
> > from haskell and [functor]?), or do you have some other name in mind?
> > Academics papers might be a good place to find a better name.
> >
>
> Sorry, as I'm no expert on functional programming I don't know the
> terminology in that domain. The question is, what is the superset of
> Predicates, Functions and Procedures (those are the concepts in [functor]
> that have an arity, right?).
>
> This superset seems to be "functor". I haven't understood yet, why you
> think it is a bad name.
>
> Again: If it practical to just call it Arity, then you should go ahead
> (pragmatism wins over oo purism ;-)
>
> Benedikt
>
>
> >
> > Thanks!!
> >
> > [1] http://en.wikibooks.org/wiki/Haskell/Applicative_Functors
> > [2]
> >
> http://download.java.net/lambda/b76/docs/api/java/util/function/BinaryOperator.html
> >
> > Bruno P. Kinoshita
> > http://kinoshita.eti.br
> > http://tupilabs.com
> >
> >
> > ----- Original Message -----
> > > From: Benedikt Ritter <[hidden email]>
> > > To: Commons Developers List <[hidden email]>
> > > Cc:
> > > Sent: Tuesday, February 12, 2013 2:45 PM
> > > Subject: Re: [functor] Change default arity of Function, Predicate and
> > Procedure
> > >
> > > Hi Matt,
> > >
> > > 2013/2/12 Matt Benson <[hidden email]>
> > >
> > >>  Hi Benedikt,
> > >>    So what you are pointing out is the "is a" vs. "has
> > > a" dichotomy?  To an
> > >>  extent, I see your point.  I could argue that the semantics of the
> word
> > >>  "implements" perhaps leaves a bit of so-called wiggle room on the
> > > is a/has
> > >>  a subject.
> > >
> > >
> > > Now we are mixing things up. I was referring to the inheritance
> > > relationships between the interfaces.
> > >
> > > The java "implements" keyword is a different concept. Indeed, I'm
> > > not sure
> > > if it (or the notion of Interfaces) is part of the OO paradigm at all.
> > > There is an interesting paper about this topic (what are the core
> > conecpts
> > > of object orientation?) [1]...
> > >
> > > Anyway the reason I'm bringing this rather academic topic up is, that I
> > > believe that a clear object-orient design will lead to a better (=
> easier
> > > to understand) API. People will work with the API. They will browse the
> > > type hierarchy to understand how things are tied together.
> > > This will lead to situations like: "okay, I have a BinaryFunction...
> what
> > > is a BinaryFuncation? Ah, it's a Binary... what is a Binary? A Binary
> > seems
> > > to be an Arity... wait.. what?"
> > >
> > > Maybe I can make myself clearer by giving a less abstract example.
> > > Consider the following set of thinks: Cars, Trucks, Motorcycles.
> > > They all have wheels of some sort. How would you model this using
> > > Interfaces?
> > > I'm sure you wouldn't define an interface "Wheel" that is
> > > extended by Car,
> > > Truck and Motorcycle.
> > > Instead you would probably define "Vehicle" with a
> > > "getNumberOfWheels()"
> > > method and let Car, Truck and Motorcycle extend Vehicle.
> > > This is what I meant when I said "Arity is not a superset of
> > > functors". it
> > > is a property, like the number of Wheels is a property of all vehicles.
> > >
> > > Again, this is all very academic. If you see it fit to create Arity and
> > > have the different functors extend it, then do it :-)
> > >
> > >
> > >>  This could devolve into a long discussion of the most
> > >>  semantically correct place to use "implements Arity*" vs.
> > > "extends Arity*"
> > >>  throughout the API, but the final result, IMO, is that the intent of
> > any
> > >>  given concrete class is clear enough, and
> Arity|Nullary|Unary|Binary|ad
> > >>  infinitum seems more convenient than e.g.
> > > "SomethingThatHasArity", etc.
> > >>
> > >
> > > I agree!
> > >
> > >
> > >>
> > >>  Does that make sense?
> > >>
> > >
> > > As I said, I think pragmatism should win over OO purism :)
> > >
> > >
> > >>
> > >>  Matt
> > >>
> > >
> > > Benedikt
> > >
> > > [1] http://dl.acm.org/citation.cfm?id=1113040
> > >
> > >>
> > >>
> > >>  On Tue, Feb 12, 2013 at 7:29 AM, Benedikt Ritter <[hidden email]
> >
> > >>  wrote:
> > >>
> > >>  > Hi Guys,
> > >>  >
> > >>  > I've had a look at the github repo and let me say at first that
> > > I'm no
> > >>  > expert in functional programming. So maybe what I'm talking is
> > > complete
> > >>  > nonsense :)
> > >>  >
> > >>  > From what I learned about the concept of arity at wikipedia it
> seems
> > > that
> > >>  > an arity is a property of a functor.
> > >>  > One could say: "A binary functor has an arity of two"
> > > (right?!)
> > >>  >
> > >>  > In the github repo you introduced an inheritance relationship
> between
> > >>  > functors and arity.
> > >>  > This maybe a good thing to do from a pracmatic POV because all
> > > functors
> > >>  > share the fact that say have an arity.
> > >>  >
> > >>  > From an object oriented POV inheritance is more then pure reuse.
> When
> > >>  > defining an inheritance relationship between concept Super and
> > concept
> > >>  Sub
> > >>  > we basically say "Every instance of Sub is also an instance of
> > > Super" or
> > >>  > short "Every Sub is also a Super"
> > >>  >
> > >>  > Now coming back to functors you have introduced a relationship that
> > > says
> > >>  > "Every BinaryFunction is a Binary and every Binary is an
> > > Arity".
> > >>  > Keeping in mind that arity is only a property of a functor (rather
> > > than a
> > >>  > superset) this seems strange (from an OO POV).
> > >>  > But as I'm no expert on functional programming this maybe the
> > > right thing
> > >>  > to do... :)
> > >>  >
> > >>  > just my 2 cents :)
> > >>  > Benedikt
> > >>  >
> > >>  >
> > >>  >
> > >>  > 2013/2/11 Bruno P. Kinoshita <[hidden email]>
> > >>  >
> > >>  > > Hi Matt!
> > >>  > >
> > >>  > > Great! I'll commit these changes tomorrow if there are no
> > > objections.
> > >>  > >
> > >>  > > Thanks!
> > >>  > >
> > >>  > > Bruno P. Kinoshita
> > >>  > > http://kinoshita.eti.br
> > >>  > > http://tupilabs.com
> > >>  > >
> > >>  > >
> > >>  > > ----- Original Message -----
> > >>  > > > From: Matt Benson <[hidden email]>
> > >>  > > > To: Commons Developers List <[hidden email]>
> > >>  > > > Cc:
> > >>  > > > Sent: Monday, February 11, 2013 8:39 PM
> > >>  > > > Subject: Re: [functor] Change default arity of Function,
> > > Predicate
> > >>  and
> > >>  > > Procedure
> > >>  > > >
> > >>  > > > Hi Bruno,
> > >>  > > >   No objections here about the Arity interfaces.  I see that
> > > your
> > >>  > master
> > >>  > > > branch also contains changes to migrate Unary* to * and * to
> > >>  Nullary*.
> > >>  > > > Personally I am satisfied to align with lambda/guava if
> > > noone else
> > >>  > > objects.
> > >>  > > >
> > >>  > > > Thanks,
> > >>  > > > Matt
> > >>  > > >
> > >>  > > >
> > >>  > > > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> > >>  > > > [hidden email]> wrote:
> > >>  > > >
> > >>  > > >>  Hi Matt, all,
> > >>  > > >>
> > >>  > > >>  I'm messing with [functor] in my GitHub mirror [1].
> > > You can find
> > >>  the
> > >>  > > >>  commits in the master branch [2].
> > >>  > > >>
> > >>  > > >>  The Arity->Unary/Binary/Nullary interfaces look
> > > good. If there are
> > >>  no
> > >>  > > >>  objections I would like to commit this change to the
> > > trunk in SVN.
> > >>  > > >>
> > >>  > > >>  There are other changes that I'll omit in this
> > > commit, but will
> > >>  start
> > >>  > > > new
> > >>  > > >>  threads here in the mailing list :o)
> > >>  > > >>
> > >>  > > >>  Thank you in advance!
> > >>  > > >>
> > >>  > > >>  [1] https://github.com/kinow/functor
> > >>  > > >>  [2] https://github.com/kinow/functor/commits/master
> > >>  > > >>
> > >>  > > >>  Bruno P. Kinoshita
> > >>  > > >>  http://kinoshita.eti.br
> > >>  > > >>  http://tupilabs.com
> > >>  > > >>
> > >>  > > >>
> > >>  > > >>  >________________________________
> > >>  > > >>  > From: Bruno P. Kinoshita <[hidden email]>
> > >>  > > >>  >To: Commons Developers List
> > > <[hidden email]>; "
> > >>  > > >>  [hidden email]" <[hidden email]>
> > >>  > > >>  >Sent: Wednesday, January 30, 2013 3:58 PM
> > >>  > > >>  >Subject: Re: [functor] Change default arity of
> > > Function, Predicate
> > >>  > and
> > >>  > > >>  Procedure
> > >>  > > >>  >
> > >>  > > >>  >I think it makes sense and is clear what is does.
> > >>  > > >>  >
> > >>  > > >>  >I thought in using {arity}Operation, but in Java 8
> > > there are
> > >>  > > interfaces
> > >>  > > >>  like BinaryOperator, and BinaryOperator extends
> > > BiFunction, so it
> > >>  > > would be
> > >>  > > >>  confusing to users having something like interface
> > > BinaryFunction
> > >>  > > extends
> > >>  > > >>  BinaryOperation in [functor].
> > >>  > > >>  >
> > >>  > > >>  >Bruno P. Kinoshita
> > >>  > > >>  >http://kinoshita.eti.br
> > >>  > > >>  >http://tupilabs.com
> > >>  > > >>  >
> > >>  > > >>  >
> > >>  > > >>  >----- Original Message -----
> > >>  > > >>  >> From: Matt Benson <[hidden email]>
> > >>  > > >>  >> To: Bruno P. Kinoshita
> > > <[hidden email]>
> > >>  > > >>  >> Cc: Commons Developers List
> > > <[hidden email]>
> > >>  > > >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
> > >>  > > >>  >> Subject: Re: [functor] Change default arity of
> > > Function,
> > >>  Predicate
> > >>  > > > and
> > >>  > > >>  Procedure
> > >>  > > >>  >>
> > >>  > > >>  >> What about:
> > >>  > > >>  >>
> > >>  > > >>  >> Arity (Marker)
> > >>  > > >>  >> |_Nullary extends Arity
> > >>  > > >>  >> |_Unary<A> extends Arity
> > >>  > > >>  >> |_Binary<L, R> extends Arity
> > >>  > > >>  >>
> > >>  > > >>  >> ?
> > >>  > > >>  >>
> > >>  > > >>  >> Matt
> > >>  > > >>  >>
> > >>  > > >>  >>
> > >>  > > >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P.
> > > Kinoshita <
> > >>  > > >>  >> [hidden email]> wrote:
> > >>  > > >>  >>
> > >>  > > >>  >>>  In Haskell you define your functions and
> > > its arity.
> > >>  > > >>  >>>
> > >>  > > >>  >>>  // nullary function
> > >>  > > >>  >>>  a :: () => () -> String
> > >>  > > >>  >>>  a = "Hello World"
> > >>  > > >>  >>>
> > >>  > > >>  >>>  // unary function
> > >>  > > >>  >>>  b :: (Integral c) => c -: String
> > >>  > > >>  >>>  b x = "Hello Integral"
> > >>  > > >>  >>>
> > >>  > > >>  >>>  I think in Clojure and Scala you can
> > > define the arity of the
> > >>  > > > function
> > >>  > > >>  too.
> > >>  > > >>  >>>
> > >>  > > >>  >>>  For the users of [functor] I think it
> > > would be easier to
> > >>  > > > migrate their
> > >>  > > >>  >>>  code to Java 8, or use it with Java 8, if
> > > both [functor] and
> > >>  > > > Java 8
> > >>  > > >>  >>>  Function classes had similar behaviour.
> > > That would be
> > >>  > > > interesting
> > >>  > > >>  >>>  especially if the lambda project provided
> > > a backport jar.
> > >>  > > >>  >>>
> > >>  > > >>  >>>  [functor] and lambda project provide 1
> > > and 2 arities by
> > >>  > > > default, but
> > >>  > > >>  >>>  lambda doesn't provide nullary
> > > interfaces (or at least I
> > >>  > > > couldn't
> > >>  > > >>  >> find them
> > >>  > > >>  >>>  in java.util.functions).
> > >>  > > >>  >>>
> > >>  > > >>  >>>  Cheers
> > >>  > > >>  >>>
> > >>  > > >>  >>>  Bruno P. Kinoshita
> > >>  > > >>  >>>  http://kinoshita.eti.br
> > >>  > > >>  >>>  http://tupilabs.com
> > >>  > > >>  >>>
> > >>  > > >>  >>>
> > >>  > > >>  >>>  ----- Original Message -----
> > >>  > > >>  >>>  > From: Matt Benson
> > > <[hidden email]>
> > >>  > > >>  >>>  > To: Commons Developers List
> > >>  > > > <[hidden email]>; Bruno P.
> > >>  > > >>  >>>  Kinoshita
> > > <[hidden email]>
> > >>  > > >>  >>>  > Cc:
> > >>  > > >>  >>>  > Sent: Tuesday, January 29, 2013 8:57
> > > PM
> > >>  > > >>  >>>  > Subject: Re: [functor] Change
> > > default arity of Function,
> > >>  > > > Predicate
> > >>  > > >>  and
> > >>  > > >>  >>>  Procedure
> > >>  > > >>  >>>  >
> > >>  > > >>  >>>  > What about in pure functional
> > > languages e.g. Haskell?
> > >>  > > >>  >>>  >
> > >>  > > >>  >>>  > Matt
> > >>  > > >>  >>>  >
> > >>  > > >>  >>>  >
> > >>  > > >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM,
> > > Bruno P. Kinoshita <
> > >>  > > >>  >>>  > [hidden email]>
> > > wrote:
> > >>  > > >>  >>>  >
> > >>  > > >>  >>>  >>  Hi all,
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>>  >>  In Java 8 and Guava the default
> > > arity of a Function
> > >>  > > > is 1, but in
> > >>  > > >>  >>>  [functor]
> > >>  > > >>  >>>  >>  it is 0, IOW, in Java 8 and
> > > Guava a Function is by
> > >>  > > > default a
> > >>  > > >>  >>>  UnaryFunction,
> > >>  > > >>  >>>  >>  while in [functor] it is a
> > > NullaryFunction.
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>>  >>  What do you guys think of
> > > changing the default
> > >>  > > > arity of Function,
> > >>  > > >>  >>>  >>  Procedure and Predicate in
> > > [functor] to 1, rather
> > >>  > > > than 0?
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>>  >>  Cheers
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>>  >>  Bruno P. Kinoshita
> > >>  > > >>  >>>  >>  http://kinoshita.eti.br
> > >>  > > >>  >>>  >>  http://tupilabs.com
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>
> > >>  > > >
> > > ---------------------------------------------------------------------
> > >>  > > >>  >>>  >>  To unsubscribe, e-mail:
> > >>  > > > [hidden email]
> > >>  > > >>  >>>  >>  For additional commands,
> > > e-mail:
> > >>  > > > [hidden email]
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>>  >>
> > >>  > > >>  >>>  >
> > >>  > > >>  >>>
> > >>  > > >>  >>
> > >>  > > >>  >
> > >>  > > >>
> > >>  >
> > >> ---------------------------------------------------------------------
> > >>  > > >>  >To unsubscribe, e-mail:
> > > [hidden email]
> > >>  > > >>  >For additional commands, e-mail:
> > > [hidden email]
> > >>  > > >>  >
> > >>  > > >>  >
> > >>  > > >>  >
> > >>  > > >>  >
> > >>  > > >>
> > >>  > > >
> > >>  > >
> > >>  > >
> > > ---------------------------------------------------------------------
> > >>  > > To unsubscribe, e-mail: [hidden email]
> > >>  > > For additional commands, e-mail: [hidden email]
> > >>  > >
> > >>  > >
> > >>  >
> > >>  >
> > >>  > --
> > >>  > http://people.apache.org/~britter/
> > >>  > http://www.systemoutprintln.de/
> > >>  > http://twitter.com/BenediktRitter
> > >>  > http://github.com/britter
> > >>  >
> > >>
> > >
> > >
> > >
> > > --
> > > http://people.apache.org/~britter/
> > > http://www.systemoutprintln.de/
> > > http://twitter.com/BenediktRitter
> > > http://github.com/britter
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Jörg Schaible-3
Hi,

Matt Benson wrote:

> TBH, I can't recall what the argument was against "Functor" either; I
> think it had something to do with potentially confusing users of other
> libraries?
>
> Functor
> |_NullaryFunctor
> |_UnaryFunctor
> |_BinaryFunctor
>
> *is* the current state.  :)  Now, when I woke up this morning I did so
> with another concept floating around in my brain (it may be crazy, or not
> work):
>
> interface Arity {
> }
>
> interface Argumented<A extends Arity> {
> }
>
> interface Unary<A> extends Arity {
> }
>
> interface UnaryFunction<A, T> extends Argumented<Unary<A>> {
> }
>
> Bear in mind the goal is to be able to inspect the type of a functor to
> determine its arity (momentarily disregarding the fact that this goal is
> seeming less worth the trouble all the while :P ).  This approach would
> make that a bit more complex, but still seemingly doable.
>
> Thoughts?

@Arity(0)
interface NullaryFunctor {
}

@Arity(1)
interface UnaryFunctor {
}

@Arity(2)
interface BinaryFunctor {
}

Crazy enough? ;-)

Do those interfaces need an ancestor?

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Matt Benson-2
Hi Jorg,
  We had at some point talked about whether these could be done with a
simple annotation.  I had hoped for something that could be expressed in
terms enforceable by the compiler.

Matt


On Wed, Feb 13, 2013 at 10:22 AM, Jörg Schaible <[hidden email]
> wrote:

> Hi,
>
> Matt Benson wrote:
>
> > TBH, I can't recall what the argument was against "Functor" either; I
> > think it had something to do with potentially confusing users of other
> > libraries?
> >
> > Functor
> > |_NullaryFunctor
> > |_UnaryFunctor
> > |_BinaryFunctor
> >
> > *is* the current state.  :)  Now, when I woke up this morning I did so
> > with another concept floating around in my brain (it may be crazy, or not
> > work):
> >
> > interface Arity {
> > }
> >
> > interface Argumented<A extends Arity> {
> > }
> >
> > interface Unary<A> extends Arity {
> > }
> >
> > interface UnaryFunction<A, T> extends Argumented<Unary<A>> {
> > }
> >
> > Bear in mind the goal is to be able to inspect the type of a functor to
> > determine its arity (momentarily disregarding the fact that this goal is
> > seeming less worth the trouble all the while :P ).  This approach would
> > make that a bit more complex, but still seemingly doable.
> >
> > Thoughts?
>
> @Arity(0)
> interface NullaryFunctor {
> }
>
> @Arity(1)
> interface UnaryFunctor {
> }
>
> @Arity(2)
> interface BinaryFunctor {
> }
>
> Crazy enough? ;-)
>
> Do those interfaces need an ancestor?
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Benedikt Ritter-4
In reply to this post by Matt Benson-2
Hi Matt,


2013/2/13 Matt Benson <[hidden email]>

> TBH, I can't recall what the argument was against "Functor" either; I think
> it had something to do with potentially confusing users of other libraries?
>
> Functor
> |_NullaryFunctor
> |_UnaryFunctor
> |_BinaryFunctor
>
> *is* the current state.  :)  Now, when I woke up this morning I did so with
> another concept floating around in my brain (it may be crazy, or not work):
>
> interface Arity {
> }
>
> interface Argumented<A extends Arity> {
> }
>
> interface Unary<A> extends Arity {
> }
>
> interface UnaryFunction<A, T> extends Argumented<Unary<A>> {
> }
>
>
This is more complicated then having the functors extend Arity, but it
makes better use of inheritance from an OO POV I think.

Just to make sure I understand correctly: If I had an UnaryFunction that
take a Boolean argument and return an Integer I would model this as:
class MyFunction implements UnaryFunction<Boolean, Integer>, right?

May this is obviouse and I just don't get it, but why do you need to define
*ary Interfaces? Wouldn't it be easier to just define:

interface Argumented {
  int getArity()
}

You would lose the information which types can be passed to the functor.
OTOH you don't have to define a new interface for every possible arity.


> Bear in mind the goal is to be able to inspect the type of a functor to
> determine its arity (momentarily disregarding the fact that this goal is
> seeming less worth the trouble all the while :P ).  This approach would
> make that a bit more complex, but still seemingly doable.
>
> Thoughts?
>
> Matt
>
> On Wed, Feb 13, 2013 at 4:50 AM, Benedikt Ritter <[hidden email]>
> wrote:
>
> > Hi Bruno,
> >
> >
> > 2013/2/12 Bruno P. Kinoshita <[hidden email]>
> >
> > > Hi Benedikt,
> > >
> > > Thanks for taking a look at the github repo and for posting your
> thoughts
> > > here.
> > >
> > > If I understand it correctly, your concern is:
> > >
> > > - In the github repo, a BinaryFunction is a Binary, and a Binary is an
> > > Arity.
> > >
> > > - But at same time, it is intuitive that a BinaryFunction "has" an
> arity,
> > > which is binary.
> >
> >
> > > Is that right? If so, I think it's a question of changing the
> > > nomenclature. The issue started because in functional languages like
> > > Haskell, a functor has a broader meaning (e.g.: a list is a functor in
> > > Haskell [1]).
> > >
> >
> > Yes, I guess it boils down to this :)
> > As Matt has pointed out, there does not seem to be a name for the
> superset
> > of things that have an arity and "SomethingThatHasArity" really is a bad
> > name :)
> >
> >
> > >
> > > Maybe we could revert this changes, or find a better name? I thought
> > about
> > > something like Operation or Operator, but in project lambda, the
> > interface
> > > BinaryOperator extends BiFunction [2]. So maybe it would be confusing
> > too,
> > > if the user was used to Java 8 (assuming both interfaces are released
> > with
> > > Java 8).
> >
> >
> > Yes, this may confuse users. Better prevent collisions with core java
> > terminology.
> >
> >
> > > What do you think? Back to Functors (and maybe document the difference
> > > from haskell and [functor]?), or do you have some other name in mind?
> > > Academics papers might be a good place to find a better name.
> > >
> >
> > Sorry, as I'm no expert on functional programming I don't know the
> > terminology in that domain. The question is, what is the superset of
> > Predicates, Functions and Procedures (those are the concepts in [functor]
> > that have an arity, right?).
> >
> > This superset seems to be "functor". I haven't understood yet, why you
> > think it is a bad name.
> >
> > Again: If it practical to just call it Arity, then you should go ahead
> > (pragmatism wins over oo purism ;-)
> >
> > Benedikt
> >
> >
> > >
> > > Thanks!!
> > >
> > > [1] http://en.wikibooks.org/wiki/Haskell/Applicative_Functors
> > > [2]
> > >
> >
> http://download.java.net/lambda/b76/docs/api/java/util/function/BinaryOperator.html
> > >
> > > Bruno P. Kinoshita
> > > http://kinoshita.eti.br
> > > http://tupilabs.com
> > >
> > >
> > > ----- Original Message -----
> > > > From: Benedikt Ritter <[hidden email]>
> > > > To: Commons Developers List <[hidden email]>
> > > > Cc:
> > > > Sent: Tuesday, February 12, 2013 2:45 PM
> > > > Subject: Re: [functor] Change default arity of Function, Predicate
> and
> > > Procedure
> > > >
> > > > Hi Matt,
> > > >
> > > > 2013/2/12 Matt Benson <[hidden email]>
> > > >
> > > >>  Hi Benedikt,
> > > >>    So what you are pointing out is the "is a" vs. "has
> > > > a" dichotomy?  To an
> > > >>  extent, I see your point.  I could argue that the semantics of the
> > word
> > > >>  "implements" perhaps leaves a bit of so-called wiggle room on the
> > > > is a/has
> > > >>  a subject.
> > > >
> > > >
> > > > Now we are mixing things up. I was referring to the inheritance
> > > > relationships between the interfaces.
> > > >
> > > > The java "implements" keyword is a different concept. Indeed, I'm
> > > > not sure
> > > > if it (or the notion of Interfaces) is part of the OO paradigm at
> all.
> > > > There is an interesting paper about this topic (what are the core
> > > conecpts
> > > > of object orientation?) [1]...
> > > >
> > > > Anyway the reason I'm bringing this rather academic topic up is,
> that I
> > > > believe that a clear object-orient design will lead to a better (=
> > easier
> > > > to understand) API. People will work with the API. They will browse
> the
> > > > type hierarchy to understand how things are tied together.
> > > > This will lead to situations like: "okay, I have a BinaryFunction...
> > what
> > > > is a BinaryFuncation? Ah, it's a Binary... what is a Binary? A Binary
> > > seems
> > > > to be an Arity... wait.. what?"
> > > >
> > > > Maybe I can make myself clearer by giving a less abstract example.
> > > > Consider the following set of thinks: Cars, Trucks, Motorcycles.
> > > > They all have wheels of some sort. How would you model this using
> > > > Interfaces?
> > > > I'm sure you wouldn't define an interface "Wheel" that is
> > > > extended by Car,
> > > > Truck and Motorcycle.
> > > > Instead you would probably define "Vehicle" with a
> > > > "getNumberOfWheels()"
> > > > method and let Car, Truck and Motorcycle extend Vehicle.
> > > > This is what I meant when I said "Arity is not a superset of
> > > > functors". it
> > > > is a property, like the number of Wheels is a property of all
> vehicles.
> > > >
> > > > Again, this is all very academic. If you see it fit to create Arity
> and
> > > > have the different functors extend it, then do it :-)
> > > >
> > > >
> > > >>  This could devolve into a long discussion of the most
> > > >>  semantically correct place to use "implements Arity*" vs.
> > > > "extends Arity*"
> > > >>  throughout the API, but the final result, IMO, is that the intent
> of
> > > any
> > > >>  given concrete class is clear enough, and
> > Arity|Nullary|Unary|Binary|ad
> > > >>  infinitum seems more convenient than e.g.
> > > > "SomethingThatHasArity", etc.
> > > >>
> > > >
> > > > I agree!
> > > >
> > > >
> > > >>
> > > >>  Does that make sense?
> > > >>
> > > >
> > > > As I said, I think pragmatism should win over OO purism :)
> > > >
> > > >
> > > >>
> > > >>  Matt
> > > >>
> > > >
> > > > Benedikt
> > > >
> > > > [1] http://dl.acm.org/citation.cfm?id=1113040
> > > >
> > > >>
> > > >>
> > > >>  On Tue, Feb 12, 2013 at 7:29 AM, Benedikt Ritter <
> [hidden email]
> > >
> > > >>  wrote:
> > > >>
> > > >>  > Hi Guys,
> > > >>  >
> > > >>  > I've had a look at the github repo and let me say at first that
> > > > I'm no
> > > >>  > expert in functional programming. So maybe what I'm talking is
> > > > complete
> > > >>  > nonsense :)
> > > >>  >
> > > >>  > From what I learned about the concept of arity at wikipedia it
> > seems
> > > > that
> > > >>  > an arity is a property of a functor.
> > > >>  > One could say: "A binary functor has an arity of two"
> > > > (right?!)
> > > >>  >
> > > >>  > In the github repo you introduced an inheritance relationship
> > between
> > > >>  > functors and arity.
> > > >>  > This maybe a good thing to do from a pracmatic POV because all
> > > > functors
> > > >>  > share the fact that say have an arity.
> > > >>  >
> > > >>  > From an object oriented POV inheritance is more then pure reuse.
> > When
> > > >>  > defining an inheritance relationship between concept Super and
> > > concept
> > > >>  Sub
> > > >>  > we basically say "Every instance of Sub is also an instance of
> > > > Super" or
> > > >>  > short "Every Sub is also a Super"
> > > >>  >
> > > >>  > Now coming back to functors you have introduced a relationship
> that
> > > > says
> > > >>  > "Every BinaryFunction is a Binary and every Binary is an
> > > > Arity".
> > > >>  > Keeping in mind that arity is only a property of a functor
> (rather
> > > > than a
> > > >>  > superset) this seems strange (from an OO POV).
> > > >>  > But as I'm no expert on functional programming this maybe the
> > > > right thing
> > > >>  > to do... :)
> > > >>  >
> > > >>  > just my 2 cents :)
> > > >>  > Benedikt
> > > >>  >
> > > >>  >
> > > >>  >
> > > >>  > 2013/2/11 Bruno P. Kinoshita <[hidden email]>
> > > >>  >
> > > >>  > > Hi Matt!
> > > >>  > >
> > > >>  > > Great! I'll commit these changes tomorrow if there are no
> > > > objections.
> > > >>  > >
> > > >>  > > Thanks!
> > > >>  > >
> > > >>  > > Bruno P. Kinoshita
> > > >>  > > http://kinoshita.eti.br
> > > >>  > > http://tupilabs.com
> > > >>  > >
> > > >>  > >
> > > >>  > > ----- Original Message -----
> > > >>  > > > From: Matt Benson <[hidden email]>
> > > >>  > > > To: Commons Developers List <[hidden email]>
> > > >>  > > > Cc:
> > > >>  > > > Sent: Monday, February 11, 2013 8:39 PM
> > > >>  > > > Subject: Re: [functor] Change default arity of Function,
> > > > Predicate
> > > >>  and
> > > >>  > > Procedure
> > > >>  > > >
> > > >>  > > > Hi Bruno,
> > > >>  > > >   No objections here about the Arity interfaces.  I see that
> > > > your
> > > >>  > master
> > > >>  > > > branch also contains changes to migrate Unary* to * and * to
> > > >>  Nullary*.
> > > >>  > > > Personally I am satisfied to align with lambda/guava if
> > > > noone else
> > > >>  > > objects.
> > > >>  > > >
> > > >>  > > > Thanks,
> > > >>  > > > Matt
> > > >>  > > >
> > > >>  > > >
> > > >>  > > > On Mon, Feb 11, 2013 at 4:25 PM, Bruno P. Kinoshita <
> > > >>  > > > [hidden email]> wrote:
> > > >>  > > >
> > > >>  > > >>  Hi Matt, all,
> > > >>  > > >>
> > > >>  > > >>  I'm messing with [functor] in my GitHub mirror [1].
> > > > You can find
> > > >>  the
> > > >>  > > >>  commits in the master branch [2].
> > > >>  > > >>
> > > >>  > > >>  The Arity->Unary/Binary/Nullary interfaces look
> > > > good. If there are
> > > >>  no
> > > >>  > > >>  objections I would like to commit this change to the
> > > > trunk in SVN.
> > > >>  > > >>
> > > >>  > > >>  There are other changes that I'll omit in this
> > > > commit, but will
> > > >>  start
> > > >>  > > > new
> > > >>  > > >>  threads here in the mailing list :o)
> > > >>  > > >>
> > > >>  > > >>  Thank you in advance!
> > > >>  > > >>
> > > >>  > > >>  [1] https://github.com/kinow/functor
> > > >>  > > >>  [2] https://github.com/kinow/functor/commits/master
> > > >>  > > >>
> > > >>  > > >>  Bruno P. Kinoshita
> > > >>  > > >>  http://kinoshita.eti.br
> > > >>  > > >>  http://tupilabs.com
> > > >>  > > >>
> > > >>  > > >>
> > > >>  > > >>  >________________________________
> > > >>  > > >>  > From: Bruno P. Kinoshita <[hidden email]>
> > > >>  > > >>  >To: Commons Developers List
> > > > <[hidden email]>; "
> > > >>  > > >>  [hidden email]" <[hidden email]>
> > > >>  > > >>  >Sent: Wednesday, January 30, 2013 3:58 PM
> > > >>  > > >>  >Subject: Re: [functor] Change default arity of
> > > > Function, Predicate
> > > >>  > and
> > > >>  > > >>  Procedure
> > > >>  > > >>  >
> > > >>  > > >>  >I think it makes sense and is clear what is does.
> > > >>  > > >>  >
> > > >>  > > >>  >I thought in using {arity}Operation, but in Java 8
> > > > there are
> > > >>  > > interfaces
> > > >>  > > >>  like BinaryOperator, and BinaryOperator extends
> > > > BiFunction, so it
> > > >>  > > would be
> > > >>  > > >>  confusing to users having something like interface
> > > > BinaryFunction
> > > >>  > > extends
> > > >>  > > >>  BinaryOperation in [functor].
> > > >>  > > >>  >
> > > >>  > > >>  >Bruno P. Kinoshita
> > > >>  > > >>  >http://kinoshita.eti.br
> > > >>  > > >>  >http://tupilabs.com
> > > >>  > > >>  >
> > > >>  > > >>  >
> > > >>  > > >>  >----- Original Message -----
> > > >>  > > >>  >> From: Matt Benson <[hidden email]>
> > > >>  > > >>  >> To: Bruno P. Kinoshita
> > > > <[hidden email]>
> > > >>  > > >>  >> Cc: Commons Developers List
> > > > <[hidden email]>
> > > >>  > > >>  >> Sent: Wednesday, January 30, 2013 1:29 PM
> > > >>  > > >>  >> Subject: Re: [functor] Change default arity of
> > > > Function,
> > > >>  Predicate
> > > >>  > > > and
> > > >>  > > >>  Procedure
> > > >>  > > >>  >>
> > > >>  > > >>  >> What about:
> > > >>  > > >>  >>
> > > >>  > > >>  >> Arity (Marker)
> > > >>  > > >>  >> |_Nullary extends Arity
> > > >>  > > >>  >> |_Unary<A> extends Arity
> > > >>  > > >>  >> |_Binary<L, R> extends Arity
> > > >>  > > >>  >>
> > > >>  > > >>  >> ?
> > > >>  > > >>  >>
> > > >>  > > >>  >> Matt
> > > >>  > > >>  >>
> > > >>  > > >>  >>
> > > >>  > > >>  >> On Tue, Jan 29, 2013 at 6:09 PM, Bruno P.
> > > > Kinoshita <
> > > >>  > > >>  >> [hidden email]> wrote:
> > > >>  > > >>  >>
> > > >>  > > >>  >>>  In Haskell you define your functions and
> > > > its arity.
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  // nullary function
> > > >>  > > >>  >>>  a :: () => () -> String
> > > >>  > > >>  >>>  a = "Hello World"
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  // unary function
> > > >>  > > >>  >>>  b :: (Integral c) => c -: String
> > > >>  > > >>  >>>  b x = "Hello Integral"
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  I think in Clojure and Scala you can
> > > > define the arity of the
> > > >>  > > > function
> > > >>  > > >>  too.
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  For the users of [functor] I think it
> > > > would be easier to
> > > >>  > > > migrate their
> > > >>  > > >>  >>>  code to Java 8, or use it with Java 8, if
> > > > both [functor] and
> > > >>  > > > Java 8
> > > >>  > > >>  >>>  Function classes had similar behaviour.
> > > > That would be
> > > >>  > > > interesting
> > > >>  > > >>  >>>  especially if the lambda project provided
> > > > a backport jar.
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  [functor] and lambda project provide 1
> > > > and 2 arities by
> > > >>  > > > default, but
> > > >>  > > >>  >>>  lambda doesn't provide nullary
> > > > interfaces (or at least I
> > > >>  > > > couldn't
> > > >>  > > >>  >> find them
> > > >>  > > >>  >>>  in java.util.functions).
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  Cheers
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  Bruno P. Kinoshita
> > > >>  > > >>  >>>  http://kinoshita.eti.br
> > > >>  > > >>  >>>  http://tupilabs.com
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>
> > > >>  > > >>  >>>  ----- Original Message -----
> > > >>  > > >>  >>>  > From: Matt Benson
> > > > <[hidden email]>
> > > >>  > > >>  >>>  > To: Commons Developers List
> > > >>  > > > <[hidden email]>; Bruno P.
> > > >>  > > >>  >>>  Kinoshita
> > > > <[hidden email]>
> > > >>  > > >>  >>>  > Cc:
> > > >>  > > >>  >>>  > Sent: Tuesday, January 29, 2013 8:57
> > > > PM
> > > >>  > > >>  >>>  > Subject: Re: [functor] Change
> > > > default arity of Function,
> > > >>  > > > Predicate
> > > >>  > > >>  and
> > > >>  > > >>  >>>  Procedure
> > > >>  > > >>  >>>  >
> > > >>  > > >>  >>>  > What about in pure functional
> > > > languages e.g. Haskell?
> > > >>  > > >>  >>>  >
> > > >>  > > >>  >>>  > Matt
> > > >>  > > >>  >>>  >
> > > >>  > > >>  >>>  >
> > > >>  > > >>  >>>  > On Tue, Jan 29, 2013 at 4:55 PM,
> > > > Bruno P. Kinoshita <
> > > >>  > > >>  >>>  > [hidden email]>
> > > > wrote:
> > > >>  > > >>  >>>  >
> > > >>  > > >>  >>>  >>  Hi all,
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>>  >>  In Java 8 and Guava the default
> > > > arity of a Function
> > > >>  > > > is 1, but in
> > > >>  > > >>  >>>  [functor]
> > > >>  > > >>  >>>  >>  it is 0, IOW, in Java 8 and
> > > > Guava a Function is by
> > > >>  > > > default a
> > > >>  > > >>  >>>  UnaryFunction,
> > > >>  > > >>  >>>  >>  while in [functor] it is a
> > > > NullaryFunction.
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>>  >>  What do you guys think of
> > > > changing the default
> > > >>  > > > arity of Function,
> > > >>  > > >>  >>>  >>  Procedure and Predicate in
> > > > [functor] to 1, rather
> > > >>  > > > than 0?
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>>  >>  Cheers
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>>  >>  Bruno P. Kinoshita
> > > >>  > > >>  >>>  >>  http://kinoshita.eti.br
> > > >>  > > >>  >>>  >>  http://tupilabs.com
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>
> > > >>  > > >
> > > > ---------------------------------------------------------------------
> > > >>  > > >>  >>>  >>  To unsubscribe, e-mail:
> > > >>  > > > [hidden email]
> > > >>  > > >>  >>>  >>  For additional commands,
> > > > e-mail:
> > > >>  > > > [hidden email]
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>>  >>
> > > >>  > > >>  >>>  >
> > > >>  > > >>  >>>
> > > >>  > > >>  >>
> > > >>  > > >>  >
> > > >>  > > >>
> > > >>  >
> > > >>
> ---------------------------------------------------------------------
> > > >>  > > >>  >To unsubscribe, e-mail:
> > > > [hidden email]
> > > >>  > > >>  >For additional commands, e-mail:
> > > > [hidden email]
> > > >>  > > >>  >
> > > >>  > > >>  >
> > > >>  > > >>  >
> > > >>  > > >>  >
> > > >>  > > >>
> > > >>  > > >
> > > >>  > >
> > > >>  > >
> > > > ---------------------------------------------------------------------
> > > >>  > > To unsubscribe, e-mail: [hidden email]
> > > >>  > > For additional commands, e-mail: [hidden email]
> > > >>  > >
> > > >>  > >
> > > >>  >
> > > >>  >
> > > >>  > --
> > > >>  > http://people.apache.org/~britter/
> > > >>  > http://www.systemoutprintln.de/
> > > >>  > http://twitter.com/BenediktRitter
> > > >>  > http://github.com/britter
> > > >>  >
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > http://people.apache.org/~britter/
> > > > http://www.systemoutprintln.de/
> > > > http://twitter.com/BenediktRitter
> > > > http://github.com/britter
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
> >
> > --
> > http://people.apache.org/~britter/
> > http://www.systemoutprintln.de/
> > http://twitter.com/BenediktRitter
> > http://github.com/britter
> >
>



--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
Reply | Threaded
Open this post in threaded view
|

Re: [functor] Change default arity of Function, Predicate and Procedure

Benedikt Ritter-4
In reply to this post by Matt Benson-2
Hi Jörg,

I like the simplicity annotations can provide.
As Matt has pointed out Annotations do not define types, which makes it
hard to let the compiler do the validation of the code.
We could implement a custom annotation post processor. But that would
require additional setup for users.

Benedikt


2013/2/13 Matt Benson <[hidden email]>

> Hi Jorg,
>   We had at some point talked about whether these could be done with a
> simple annotation.  I had hoped for something that could be expressed in
> terms enforceable by the compiler.
>
> Matt
>
>
> On Wed, Feb 13, 2013 at 10:22 AM, Jörg Schaible <
> [hidden email]
> > wrote:
>
> > Hi,
> >
> > Matt Benson wrote:
> >
> > > TBH, I can't recall what the argument was against "Functor" either; I
> > > think it had something to do with potentially confusing users of other
> > > libraries?
> > >
> > > Functor
> > > |_NullaryFunctor
> > > |_UnaryFunctor
> > > |_BinaryFunctor
> > >
> > > *is* the current state.  :)  Now, when I woke up this morning I did so
> > > with another concept floating around in my brain (it may be crazy, or
> not
> > > work):
> > >
> > > interface Arity {
> > > }
> > >
> > > interface Argumented<A extends Arity> {
> > > }
> > >
> > > interface Unary<A> extends Arity {
> > > }
> > >
> > > interface UnaryFunction<A, T> extends Argumented<Unary<A>> {
> > > }
> > >
> > > Bear in mind the goal is to be able to inspect the type of a functor to
> > > determine its arity (momentarily disregarding the fact that this goal
> is
> > > seeming less worth the trouble all the while :P ).  This approach would
> > > make that a bit more complex, but still seemingly doable.
> > >
> > > Thoughts?
> >
> > @Arity(0)
> > interface NullaryFunctor {
> > }
> >
> > @Arity(1)
> > interface UnaryFunctor {
> > }
> >
> > @Arity(2)
> > interface BinaryFunctor {
> > }
> >
> > Crazy enough? ;-)
> >
> > Do those interfaces need an ancestor?
> >
> > - Jörg
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>



--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
12