6macros: discussing the finer points of Perl 6 macros, Qtrees, and how to stay sane | irclog: irclog.perlgeek.de/6macros/today
Set by moderator on 28 July 2015.
01:30 cognominal joined 01:48 ilbot3 joined 01:54 vendethiel joined 07:17 FROGGS joined 10:27 FROGGS joined
vendethiel tracks, huh? 21:27
masak: so, you've embraced Python? :P
masak that's perhaps exaggerating a bit 21:35
but I've been teaching it a bit recently, so I decided to try my hand at writing the same small search in both Perl 6, Perl 5 and Python 3 21:36
without a doubt, Perl 6 has the fewest frustrations for me. I know that's subjective, but I'd like to think it's also partly not :)
vendethiel: just as a small example, in Python 3: 21:41
RIGHT_DIRECTIONS = LEFT_DIRECTIONS[-1:] + LEFT_DIRECTIONS[:-1]
I believe this is quite idiomatic Python
now, the corresponding line of Perl 6, directly translated would've been `constant RIGHT_DIRECTIONS = LEFT_DIRECTIONS[-1], flat LEFT_DIRECTIONS[0..*-2];` 21:42
which loses in so many ways
but idiomatic Perl 6 is just `constant RIGHT_DIRECTIONS = LEFT_DIRECTIONS.rotate(-1);` \\o/ 21:43
er, LEFT_DIRECTIONS[*-1], of course
vendethiel doesn't itertools have something in the bag for you? 21:44
(pun intended)
masak not as far as I know 21:45
though I do agree that itertools is a big help in many cases
vendethiel doesn't know much about Python 21:59