Two small points of feedback
Mark Thornton
mthornton at optrak.com
Fri Jan 4 08:42:38 PST 2013
On 04/01/13 14:42, Stephen Colebourne wrote:
> In our regular lunchtime meeting at OpenGamma I posed two questions to
> get feedback:
>
> 1) "What does this code do"
>
> range(1, 10).forEach( (i) -> System.out.println(i) );
>
> First response "if that doesn't print 1 to 10 then someone needs their
> head examining" (someone working in multiple languages more focussed
> on maths than Java coding)
It isn't just Java where the half open interpretation might be expected.
I think that would be the expectation in many C derived languages. There
is also a family of languages where closed intervals are normal
(Fortran, Pascal, etc). Either be explicit about inclusion or accept
that Java is a member of the half open group of languages.
Incidentally, mathematicians might expect (1,10) to mean the set that
excludes both ends!
Mark
More information about the lambda-dev
mailing list