Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'd really like to see user-defined infix operators such as those in Haskell. There are some baked into the standard library (*+-/ etc), but you can also roll your own, so people could make do until this gets accepted.


You can get cute about it:

http://code.activestate.com/recipes/384122-infix-operators/

The code there overrides | to construct arbitrary operators that are used by wrapping an object in |, like:

    a |x| b
where x defines the custom behavior.




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

Search: