Football for the Lose
[ rakaur on Sat Oct 30 at 09:26 PM // category: eawr, programming, school, technology ]
So, we lost 20-28 today in the first regional game. It sucked. Pana was much more fun. I wouldn’t have regretted staying home.
In other news, I still find myself unable to find even basic documentation on Ruby that isn’t outdated. I really want to get all the information I can on this language (even though I believe Python to be the “right choice,” which I’ll go into). I need to get my hands on the second edition of Programming Ruby: The Pragmatic Programmer’s Guide but it seems as if no one is.. ahem.. distributing it. I don’t have the $30-45 to shell out for it.
I still believe Python to be more elegant. Maybe it’s just me, but:
[x for x in li if os.path.isdir(x)]
just looks more natural than:
li.collect do |x|
x if File::directory? x
end
And even so, with the first you’d wind up with everything that’s a directory. With the second you’d wind up with everything that’s a directory, and everything that’s not a directory replaced with nil. I see no way to prune this, either.
Update: You can apparently prune it with this:
li.delete_if do |x|
x.nil?
end
But that’s still an extra step. A filter iterator would be more apt than collect/map in this case.
Update: Okay so I was tired when I posted that. Obviously you could just do:
li.delete_if do |x|
!File::directory? x
end
My bad.
Anyway, back to having nothing to do.
Someone buy me this.
-- rakaur // 2004.10.30 @ 09:26 PM
0 TrackBacks
Listed below are links to blogs that reference this entry.
TrackBack URL for this entry: http://mt.ericw.org/mt-tb.cgi/28
