melanoman: (Default)
[personal profile] melanoman
I'm looking at the examples on this page and so far everything looks like scheme with the verbs moved around.

The option bind example tweaked me as being really bad code. The expression

new F<Integer, Option<Integer>>() {  
    public Option<Integer> f(final Integer i) {  
        if(i % 2 == 0) return some(i * 3); else return none();  
    }
}


is repeated thrice. Why not save the expression in a variable?

F<Integer, Option<Integer>>() trippleOdd = new F<Integer, Option<Integer>>() 
{  
    public Option<Integer> f(final Integer i) 
    {  
        if(i % 2 == 0) return some(i * 3); 
        else return none();  
    }
};


As far as I can tell the scope bindings would all be identical and the result is unchanged. Switching from learning mode to judgmental mode: This is Bad Code(tm) unless someone can tell me why it isn't.
From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

Profile

melanoman: (Default)
melanoman

March 2013

S M T W T F S
     12
3456789
10111213141516
17181920212223
2425262728 2930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 22nd, 2017 04:54 pm
Powered by Dreamwidth Studios