elfs: (Default)
[personal profile] elfs
Sometimes, what I do feels like incantation. I wanted a word count on my "working directory" displays, which I maintain using python scripts. Once upon a time, this would have taken me a few lines. Maybe ten or so. And then I learned Ruby. I learned the difference between a fold, a filter, and a transform. And I learned when to do which.

def wc(f): return Numeric.sum([len(i.split()) for i in open(f, "r") if i])

I don't get paid enough for knowing this stuff.

Date: 2007-03-07 01:00 pm (UTC)
From: [identity profile] funos.livejournal.com
Yeah, stuff like list comps and map and filter do feel like magic at times. Not because they are incomprehensible, but because they are so wonderful!

I guess the same was said of for loops when one moved to them from assembly.

Profile

elfs: (Default)
Elf Sternberg

December 2025

S M T W T F S
 12345 6
78910111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 31st, 2025 02:00 am
Powered by Dreamwidth Studios