Hacker News new | past | comments | ask | show | jobs | submit login

In general, I think verbs should be avoided, when possible, as names of functional operations. For instance, in Java, 'BigInteger.add' should have been 'plus'. Compare:

  x.add(y);
  x.plus(y);
People have been known to write the first one expecting 'x' to be updated. With the second, I think it's clearer that it's a value that needs to be assigned to a variable.

For the operation in question here, I suggest 'with'. This is what I have used in my own functional collections libraries; I think it originated in SETL.




I am a fan of nouns(or gerunds) for pure functions, and verbs for mutating functions. I.e:

    x.add(y); // x now equals x + y 
    x.adding(y); // returns x + y without mutating x




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: