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

I think Perl 6 has this concept of using the language to modify itself. Not exactly through homoiconicity, but the concept is somewhat similar.



  sub infix:<d> ( $count, $faces ) {
    (1..$faces).roll($count)
  }
  # from this point on the language has changed to have a
  # new infix operator
  
  say 5 d 20;
  # (13 5 3 3 14)
The Rakudo implementation also has macros and Slangs which are more powerful, but we want it to have a better interface; so they are not part of the Perl 6 spec yet.




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

Search: