Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [C&C] Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- Date: Wed, 28 May 2008 11:29:40 +0900
- From: Dave Brown <dagbrown@example.com>
- Subject: Re: [C&C] Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- References: <877idqf5cr.fsf@uwakimon.sk.tsukuba.ac.jp> <48321A9C.4080204@sun.com> <4832317C.5020302@ca2.so-net.ne.jp> <d8fcc0800805252005k4af915b0g92eb7fee2feb15f1@mail.gmail.com> <20080526032058.GA1627@lucky.cynic.net> <1d581afe0805252133oa3824f6h9eed843790410033@mail.gmail.com> <1211782295.9693.1255055343@webmail.messagingengine.com> <87skw5rleq.fsf@uwakimon.sk.tsukuba.ac.jp> <20080527083241.GA8248@phb> <87ej7nlj40.fsf@uwakimon.sk.tsukuba.ac.jp>
- User-agent: Mutt/1.5.17 (2007-11-01)
On Wed, May 28, 2008 at 03:03:43AM +0900, Stephen J. Turnbull wrote: > Dave Brown writes: > > On Tue, May 27, 2008 at 03:05:17AM +0900, Stephen J. Turnbull wrote: > > > David J Iannucci writes: > > > > > > > Much as I love Perl, I must admit that the concise beauty of the way > > > > Ruby applies the string transformation without the side-effect takes > > > > the cake :-) > > > > > > Hm? Perl uses the editable buffer model, Ruby has immutable strings, > > > Emacs provides both. Dif'rent strokes. > > > > I think you're confusing Ruby and Python there. Ruby's strings are as > > editable as you like. > > No, I'm inferring it from David I's comment about lack of side effect. > Does Ruby also provide a method with the same signature that mutates > the string in-place? For certain. You just have to be more emphatic and and use #sub! instead of #sub. > > (Symbols are immutable, but it would make no sense for them to be > > anything else.) > > Actually, I've seen code in Lisp that mutates symbol names. The > symbols are gensyms (ie, uninterned) whose values are parse trees and > the like, and the idea was to provide an indication of the state from > the pname. Sort of like the way many programs manipulate argv[0]. > > Now, I don't say this makes sense to sane and/or earthly programmers, > but you have to admit there's a semblance of internal logic there. > Dave? Dave? Oh, was it "ettiquette time"? At least you didn't > spontaneously combust! I only have a *mild* headache. It vaguely reminds me of editing my Commodore 64's BASIC interpreter so that FOR was now called CAT or something. I didn't get out much as a kid, why do you ask? > P.S. "As editable as I like?" You dare say that to an Emacs user? > Prove it! I'll follow the adventures of a variable called "x" (which I use because I once encountered a book on programming that said that "x" is the very last name you should use for anything other than a coordinate) for a bit for you then. irb(main):001:0> x = "foo" => "foo" irb(main):002:0> x[0] = "bar" => "bar" irb(main):003:0> x => "baroo" The String#[] method can also take two arguments. irb(main):004:0> x[3,0] = "quux" => "quux" irb(main):005:0> x => "barquuxoo" You can use sub! and gsub! to edit strings. The second is global search and replace. irb(main):006:0> x.sub! /[aeiou]/, "honk" => "bhonkrquuxoo" irb(main):007:0> x.gsub! /[aeiou][^aeiou]/, "BANG" => "bhBANGkrquBANGoo" You can use different classes of argument for String#[], like a range, another string, or a regex. irb(main):008:0> x[5..99]="hurk" => "hurk" irb(main):009:0> x => "bhBANhurk" irb(main):009:0> x["hurk"] = "fred" => "bhBANfred" irb(main):010:0> x[/[A-Z]+/] = "EXCLAMATION" => "bhEXCLAMATIONfred" And there are also a handful of alphabetic-manipulation methods: irb(main):011:0> x.downcase! => "bhexclamationfred" irb(main):011:0> x.capitalize! => "Bhexclamationfred" irb(main):012:0> x.upcase! => "BHEXCLAMATIONFRED" Plus a bunch of others, of course. --Dave
- References:
- Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Stephen J. Turnbull
- Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Jim Grisanzio
- Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Shin MICHIMUKO
- Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Josh Glover
- Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Curt Sampson
- Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Ian Barwick
- Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: David J Iannucci
- [C&C] Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Stephen J. Turnbull
- Re: [C&C] Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Dave Brown
- Re: [C&C] Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- From: Stephen J. Turnbull
Home | Main Index | Thread Index
- Prev by Date: Re: [C&C] Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- Next by Date: [tlug] B Flets blocks port 25?
- Previous by thread: Re: [C&C] Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- Next by thread: Re: [tlug] OT: interesting NY times article:High-Tech Japanese, Running Out of Engineers
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links