1,666 karma · joined April 13, 2009
But if you actually wanted to get the job done idiomatically, the code is one short, simple line of Perl 6. The performance, while admittedly slower, is within the same order of magnitude as your Perl 5 version.
To me, this is the magic of Perl 6. Sure, if you want to use 16 lines of loopy integer-crunching code to calculate the first N primes and you care about speed, Perl 6 should not be your choice. On the other hand, if you'd prefer to say
(1..$N).grep(*.is-prime)
and get the answer back in reasonable speed, Perl 6 is perfect.Today, while those two things are still slow enough in Perl 6 I wouldn't make Perl 6 my primary language for doing them, I can't even remember the last time I wrote a script in Perl 6 and it was too slow to be usable.
Mind, I think Perl 5 is still faster on things Perl 5 was super-optimized for -- regex processing, for instance. But on a normal week, I throw together a couple of quick Perl 6 scripts to get stuff done. It's usually a joy to program in and execution speed just hasn't been a problem for me.
(But yes, the unix-like OS that doesn't require a lot of fiddling about and has nice GUI is the big thing for me, too.)
(Disclaimer: I have a MBP with Touch Bar, but I do 95% of my interacting with it with an external keyboard and mouse because I hate the keyboard / Touch Bar so much.)
Very frustrating, as I considered the first edition to be essential and upon reading your comment, instantly went to purchase the 2nd edition.
Edited to add: Found a date, Amazon is listing it as October 21, 2019.
It's 100% not added verbosity in any way. Added complexity, sure, but it's a pretty straightforward application of some of the main ideas of the language, usable in the standard C-language-family way out of the box, and powerful and flexible when you understand it.
put/say are output functions which automatically add a newline at the end.
If you want fancier formatting, printf is available as well.
And notice the relative lengths of these names. As much as possible, p6 is organized so that the more commonly used thing will have the shorter name.
PS I don't think I have ever used put in p6. My code uses say, or print if I don't want a newline added to the output.
The argument in this article isn't some sophisticated take on the poem. It's just a straight literal reading of what the poem says. The only bit that's in any way fancy is recognizing that when the poet says he's going to say something (instead of just directly saying that something) you might have to think about why the poet is putting things in that very roundabout way.
Personally, I don't think I've read more than a novel's worth from any of the authors in the article -- hadn't even heard of half of them -- whereas I've read maybe ten of Vance's? He's maybe more remembered for his fantasy than SF, but I'd say he's frequently mentioned and reprinted.
Not that I've tried this (haven't programmed in 6502 assembly in 30+ years now) but doesn't that suggest he should order the bytes in the opposite direction? (ie, if I'm understanding correctly, he's using little-endian now but his comments make me wonder if big-endian might be more efficient on 6502.)
In the course of getting ready for a test I read over the Cliff Notes on the play as well. Much to my surprise it it described several humorous scenes which were completely gone in the version we read. It turns out they were cut from the middle school version because they were considered too bawdy for us.
I do know that I focused on AI in my electives for UMich's CS degree circa 1990, and from the sounds of it the AI I studied will have literally nothing in common with what is described as AI for CMU's new degree.