tools of the trade ( was Re: [Charlotte.PM] find index of array
diona at studio12a.com
Thu Mar 24 08:22:35 PST 2005
I definitely agree that compactness isn't always advantageous. I really
value cleanliness and clever shortcuts. Seems like everyone has their
growing bag of coding tricks. In any project, it's easy to use the wrong
tool. I like all the options a richer language offers, even if it does
increase the learning curve.
Between SQL, XHTML, CSS, Perl, Templating systems, CPAN, etc...it's
impossible to keep everything in your head. Plus, there's life too. :)
On Thu, 2005-03-24 at 08:49 -0500, Dale Lancaster wrote:
> The ultimate "compact language" is Forth and that was just way too wierd to
> use as a serious lanuage. I am in agreement, more compact does not mean
> more useful. I do believe that the most commonly used features should be
> optimized and made as easy to use as possible. I think the grep() function
> is a good example, but much like a Craftsman tool screwdriver, you could use
> it for the wrong things, but fortunately not void your warranty :-).
> ----- Original Message -----
> From: "William McKee" <william at knowmad.com>
> To: "Dale Lancaster" <dale at lancaster.hm>
> Cc: <charlotte at pm.org>
> Sent: Thursday, March 24, 2005 6:09 AM
> Subject: Re: [Charlotte.PM] find index of array element
> > On Wed, Mar 23, 2005 at 12:45:24PM -0500, Dale Lancaster wrote:
> >> I think the original requirement was to return the index in the original
> >> list of the matching element, not the actual element. I don't believe
> >> the
> >> below accomplishes that.
> > You're right, it doesn't match the requirements. I was thinking form
> > (she used the keywords grep and array) over function.
> >> Funny, that your example would actually produce the same answer in my
> >> test code, but only because perl is subtracting 1 from the value of
> >> the element in the matching array.
> > Yeah, that's sheer coincidence. Substituting chars for numbers makes it
> > very clear.
> >> This is probably as fast or faster than my original code and of course
> >> doesn't parse the whole array and is much more readable and maintainable
> >> (and extensible).
> > Although map and grep are very cool techniques, it's interesting to find
> > ways in which they are not as efficient as just writing it out the long
> > way (like I used to do before I understood these functions).
> > Your point reminds me of a recent article I was reading by ESR while
> > looking at the various F/OSS CMS products available. One of the benefits
> > that he tauts when comparing Python to Python is the compactness of the
> > Python language.
> > I can see where there is some benefit to having to remember fewer
> > commands to get your work done. At some point though, you're going to
> > hit the limitations of the language. Sure, it's hard to fit all of
> > Perl's functions much less the growing mass of modules on CPAN into
> > your head. All-in-all, I'd prefer the richer language to the compact
> > language. I presume most folks on this mailing list are of the same
> > opinion; anyone care to proffer a counter-argument (even if you're not
> > beholden to it, it might make for an interesting discussion).
> > William
> >  http://www.linuxjournal.com/article/3882
> > --
> > Knowmad Services Inc.
> > http://www.knowmad.com
> charlotte mailing list
> charlotte at pm.org
More information about the charlotte