commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita" <brunodepau...@yahoo.com.br>
Subject Re: [functor] Change default arity of Function, Predicate and Procedure
Date Mon, 11 Feb 2013 22:25:24 GMT
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 <kinow@apache.org>
>To: Commons Developers List <dev@commons.apache.org>; "gudnabrsam@gmail.com" <gudnabrsam@gmail.com>

>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 <gudnabrsam@gmail.com>
>> To: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
>> Cc: Commons Developers List <dev@commons.apache.org>
>> 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 <
>> brunodepaulak@yahoo.com.br> 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 <gudnabrsam@gmail.com>
>>>  > To: Commons Developers List <dev@commons.apache.org>; Bruno P.
>>>  Kinoshita <brunodepaulak@yahoo.com.br>
>>>  > 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 <
>>>  > brunodepaulak@yahoo.com.br> 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: dev-unsubscribe@commons.apache.org
>>>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>>  >>
>>>  >>
>>>  >
>>> 
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>For additional commands, e-mail: dev-help@commons.apache.org
>
>
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message