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

Perl6 allows you to define your own operators:

  $ perl6

  > sub infix:<J>   ($sep, @list) { @list.join($sep) }
  > sub prefix:<J,> (@list)       { @list.join(',')  }

  > ':' J <one two three four>;
  one:two:three:four

  > J,<five six seven eight>;
  five,six,seven,eight


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: