Hi --

On Mon, 13 Aug 2007, Felix Windt wrote:

>> -----Original Message-----
>> From: Bertram Scharpf [mailto:lists / bertram-scharpf.de]
>> Sent: Sunday, August 12, 2007 11:04 PM
>> To: ruby-talk ML
>> Subject: Re: first and last char
>>
>> Hi,
>>
>> Am Sonntag, 12. Aug 2007, 02:43:00 +0900 schrieb Felix Windt:
>>>> -----Original Message-----
>>>> From: botp [mailto:botpena / gmail.com]
>>>> Sent: Saturday, August 11, 2007 10:30 AM
>>>>
>>>> wish there were #first and #last in String
>>>
>>> irb(main):001:0> class String
>>> irb(main):002:1> def first
>>> irb(main):003:2> self.split('').first
>>> irb(main):004:2> end
>>> irb(main):005:1> def last
>>> irb(main):006:2> self.split('').last
>>> irb(main):007:2> end
>>> irb(main):008:1> end
>>> => nil
>>> irb(main):009:0> "testing".first
>>> => "t"
>>> irb(main):010:0> "testing".last
>>> => "g"
>>
>> Sometimes I wish every young programmer was forced to do a
>> month in Assembler and another one in C just to see what cost
>> in time and space some constructions cause.
>>
>> Sorry, Felix!
>>
>> Bertram
>>
>>
>> --
>> Bertram Scharpf
>> Stuttgart, Deutschland/Germany
>> http://www.bertram-scharpf.de
>>
>
> No problem :o)
>
> When posting here, I tend to forget that I usually either write throwaway
> scripts (one time processing of a problem), or scripts that get run
> occasionally on faily large servers. So far, considering processing time and
> memory simply stepped into the background over finding a solution quickly -
> if a script takes 2 minutes longer to run but took 5 minute fewer to write
> while solving something immediate, that's a net win in most situations I use
> ruby in.
>
> You're completely right, though, it's far from best practices.

If it results in a net win, then it sounds like it is a best practice.
Don't worry; there will be plenty of opportunity for performance
examination and critique, where it matters.

Assembler is really cool, though.  Definitely worth a look :-)


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)