From andrew at sweger.net Tue Jun 12 11:29:58 2007 From: andrew at sweger.net (Andrew Sweger) Date: Tue, 12 Jun 2007 11:29:58 -0700 (PDT) Subject: SPUG: YAPC::NA 2007 is almost here Message-ID: YAPC::NA 2007 is only 13 days away! If you haven't already registered, it's not too late! Visit the YAPC::NA website - http://conferences.mongueurs.net/yn2007 - to get registered. Don't miss out on the largest Perl gathering of North America! On campus housing wants final numbers on June 15. Don't wait until the last minute! ACT now! For one easy payment of just $100 you'll get: - Three days packed with 36 hours of talks - Opportunities to meet various members of the Perl community - Chance to attend a variety of Birds of a Feather sessions(BOFs) - Conference T-shirt - Swag bag full of all sorts of goodies (including a particular Perl magazine ) - A night of gaming fun and Glow Bowling at the UC Games Room (more information coming soon) - Dinner at the Tuesday night Banquet - Texas Barbecue themed - Face time with potential employers at the Job Fair - Updates on major Perl projects - Keynotes by The Perl Foundation and Larry Wall himself Plus, for $200 more dollars, we'll throw in two extra days of Perl! That's right, following the conference, Stonehenge is offering two 2-day training sessions at prices well under market value. brian d foy will be offering two days of Intermeidate Perl with Randal Schwartz covering Perl Best Practices and Persistent Perl Data. Visit the Master Class page on the YAPC to find out more - http://conferences.mongueurs.net/yn2007/master.html Don't have $200, but still want more Perl? Then stay for the Hackathon! Two days of hacking fun and helping out on various projects. There's a wiki page on the site for signing up - http://conferences.mongueurs.net/yn2007/wiki?node=Hackathon From dwilburn at whitepages.com Wed Jun 13 18:13:19 2007 From: dwilburn at whitepages.com (Daina Wilburn) Date: Wed, 13 Jun 2007 18:13:19 -0700 Subject: SPUG: Meeting Announcement -- 19 June, 2007 Message-ID: <99EC30D21F5A8A44B1369983D2D95299718F1C@netmail.corp.w3data.com> June 2007 Seattle Perl Users Group (SPUG) Meeting ==================================================== Topic: Python for Perl Mongers Speaker: Bill Campbell of Celestial Software, LLC Meeting Date: Tuesday, 19 June 2007 Meeting Time: 6:30 - 8:30 p.m. Location: Whitepages.com offices, downtown Seattle Cost: Admission is free and open to the public Info: http://seattleperl.org/ ==================================================== This coming Tuesday, June 19th, should bring out the beast, I mean BEST in us all, as we come together once again for the monthly meeting of ....... (dun da da dun!....) THE SEATTLE PERL USERS GROUP! (APPLAUSE) (thanks) This month Bill Campbell of Celestial Software (http://www.celestial.com) will be giving a very interesting talk on "Python for Perl Mongers". Here's an outline of the discussion: - [ ] Python for Perl mongers. - [ ] Introduction and background - [ ] Documentation - [ ] Books - [ ] Perl to Python Migration by Martin C. Brown - [ ] Python Cookbook - [ ] On-line documentation - [ ] python reference - [ ] python library reference - [ ] Documentation in source - [ ] pydoc - [ ] Interactive testing - [ ] Program formatting - [ ] Indentation/Style ``steaming pile of dinosaur dung'' - [ ] Embedding curly braces in comments - [ ] Wrapping statements with parenthesis - [ ] Tabs vs space, potential problems - [ ] Variable types and syntax - [ ] Simple variables - [ ] strings - [ ] Must convert strings to other types - [ ] int and longs - [ ] float - [ ] decimal, fixedpoint - [ ] dictionaries/hashes - [ ] using the ``dict'' command to simplify definitions - [ ] Methods - [ ] copy - [ ] del - [ ] pop - [ ] update - [ ] lists and tuples - [ ] subscript syntax and operations - [ ] strings may be treated as immutable lists. - [ ] Tuples are immutable lists -- may be key to dictionaries - [ ] List methods - [ ] append - [ ] del - [ ] extend - [ ] index - [ ] insert - [ ] pop - [ ] Python syntax -- simple - [ ] No compound statements if(a = b)... - [ ] Minimal magic - [ ] Regular expressions -- perl standard - [ ] function definitions - [ ] parameters - [ ] must be declared - [ ] default values - [ ] *args - [ ] **kwargs - [ ] Returns - [ ] May contain sub functions and classes - [ ] Exception handling - [ ] Basic syntax - [ ] Creating exception classes - [ ] Standard library - [ ] Modular nature of python compared to perl - [ ] import package - [ ] from package import - [ ] Object Oriented Programming - [ ] Creating Classes - [ ] AUTOLOAD -- NOT! - [ ] attributes - [ ] methods - [ ] special methods - [ ] Modules - [ ] Building packages for installation - [ ] distutils - [ ] ezinstall -- not easy - [ ] Open source program sources Here's Bill's and Celestial's contact information: Bill Campbell; Celestial Software LLC PO Box 820; 6641 E. Mercer Way Mercer Island, WA 98040-0820; INTERNET: bill at Celestial.COM URL: http://www.celestial.com/ Phone: (206) 236-1676 FAX: (206) 232-9186 Thanks so much, Bill! We're looking forward to having you! (MORE APPLAUSE, PLEASE) (thanks again) So, come one and all! Remember to bring someone who hasn't ventured over before, and, of course, remember to bring yourself! Thanks again to all the SPUG members that show up at meetings or participate on the list to make the group worthwhile in the first place, and all the JAPHs out there for just being. Meeting Location ================ Whitepages.com is located on the 16th floor of the Rainier Square Tower (1301 5th Avenue, Seattle) which is across from the 5th Avenue Theater. See the directions[1] for a quick primer on how to reach us from various locations across Puget Sound. There are plenty of locations to park in the area, including on the street. If you're looking for off-street parking, you can park in the Rainier Square garage which has an entrance on Union St. After 6PM, the building management restricts access to most floors. Our host is trying to take care of this, but if unsuccessful, they will station someone on the 1st floor near the elevator bank and 5th Avenue entrance to let people in. Worst case scenario, give the host a call on his cell phone[2] or [3] and he'll run down to let you in. Our hosts are providing a generous assortment of free sodas, fruit drinks, teas, and coffee, and also have some snacks. You definitely won't dehydrate here. See you there! -DW [1] - http://www.whitepagesinc.com/locations [2] - 206 354 7789 - Colin Meyer [3] - 206-271-9267 - Daina Wilburn _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ From MichaelRWolf at att.net Thu Jun 14 14:00:50 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 14 Jun 2007 14:00:50 -0700 Subject: SPUG: One Python users' view of Perl Message-ID: <003e01c7aec7$179bf450$0500a8c0@mlaptop> As a warm-up for Bill's upcoming talk, I'd like to share a recent Perl/Python conversation I had with a stranger. If you have similar insights, perhaps they could add some insights to the group, and feed the discussion for next weeks' meeting. Seeing a GNU shirt on a fellow patron at my favorite coffee shop, I struck up a conversation. When I mentioned that I was a Perl evangelist (i.e. instructor, user, and community member), he shared that he never did quite like Perl, so I asked him why. In a nutshell, he said that when he was looking at existing Perl code that there were too many "idioms" ("non-obvious clever linguistic nuances", by my reading of his intent) to learn in order to be effective. TMTOWTDI was *not* his friend. He found that Perl programmers reveled in TMTOWTDI, choosing to solve a particular problem with too many ways. By contrast, the Python community seemed to standardize on one way. He preferred that. And as new idioms became more popular, the older ones were abandoned, with code rewritten to use the more "modern" forms. My personal opinion is [Self-editor note: Paragraph shortened considerably... blah, blah, blah. Perl is expressive, and efficient. Perl is not canonical. The expressiveness can go too far.] BUT... ultimately, it doesn't matter what *I* think (as an trainer), or what *you* think (as a user). If the language, the culture, and the community are to grow, what matters is what the *outsiders* think. Do you have an outsiders' view that you can share, personal or second-hand? I'm too close to Perl to have much of an outsiders' insight, so I'd love to learn what you think. Thanks, Michael P.S. If we, as insiders, listen, we'll learn more than if we defend. -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From atom.powers at gmail.com Thu Jun 14 14:20:00 2007 From: atom.powers at gmail.com (Atom Powers) Date: Thu, 14 Jun 2007 14:20:00 -0700 Subject: SPUG: One Python users' view of Perl In-Reply-To: <003e01c7aec7$179bf450$0500a8c0@mlaptop> References: <003e01c7aec7$179bf450$0500a8c0@mlaptop> Message-ID: On 6/14/07, Michael R. Wolf wrote: > In a nutshell, he said that when he was looking at existing Perl code that > there were too many "idioms" ("non-obvious clever linguistic nuances", by my > reading of his intent) to learn in order to be effective. TMTOWTDI was > *not* his friend. He found that Perl programmers reveled in TMTOWTDI, > choosing to solve a particular problem with too many ways. By contrast, the > Python community seemed to standardize on one way. He preferred that. And > as new idioms became more popular, the older ones were abandoned, with code > rewritten to use the more "modern" forms. > Although I wouldn't call myself an evangelist, I have used perl quite a bit in the past and I have found the "short and easy" way to do something is often not the supportable way. I often force myself to write the code out in the long form so that others after me can have a hope of understanding what I'm doing. But I would fight against any attempt to "standardize" the way perl is written. Perhaps a "best practices" document or a "crib sheet" of common shortcuts would be useful. -- -- Perfection is just a word I use occasionally with mustard. --Atom Powers-- From andrew at sweger.net Thu Jun 14 14:55:10 2007 From: andrew at sweger.net (Andrew Sweger) Date: Thu, 14 Jun 2007 14:55:10 -0700 (PDT) Subject: SPUG: One Python users' view of Perl In-Reply-To: Message-ID: On Thu, 14 Jun 2007, Atom Powers wrote: > Although I wouldn't call myself an evangelist, I have used perl quite > a bit in the past and I have found the "short and easy" way to do > something is often not the supportable way. I often force myself to > write the code out in the long form so that others after me can have a > hope of understanding what I'm doing. Forget others that come after me. I find myself (regardless of the language) using longer expressions of what I'm trying to do in the code just so *I* have a hope of understanding what I'm doing (or trying to do). -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. From julesa at pcf.com Thu Jun 14 16:00:06 2007 From: julesa at pcf.com (Jules Agee) Date: Thu, 14 Jun 2007 16:00:06 -0700 Subject: SPUG: One Python users' view of Perl In-Reply-To: References: Message-ID: <4671C876.5000603@pcf.com> Andrew Sweger wrote: > On Thu, 14 Jun 2007, Atom Powers wrote: > >> Although I wouldn't call myself an evangelist, I have used perl quite >> a bit in the past and I have found the "short and easy" way to do >> something is often not the supportable way. I often force myself to >> write the code out in the long form so that others after me can have a >> hope of understanding what I'm doing. > > Forget others that come after me. I find myself (regardless of the > language) using longer expressions of what I'm trying to do in the code > just so *I* have a hope of understanding what I'm doing (or trying to do). Once I even resorted to adding a comment explaining what a piece of code did. From bill at celestial.com Thu Jun 14 16:27:25 2007 From: bill at celestial.com (Bill Campbell) Date: Thu, 14 Jun 2007 16:27:25 -0700 Subject: SPUG: One Python users' view of Perl In-Reply-To: References: Message-ID: <20070614232725.GA4848@ayn.mi.celestial.com> On Thu, Jun 14, 2007, Andrew Sweger wrote: >On Thu, 14 Jun 2007, Atom Powers wrote: > >> Although I wouldn't call myself an evangelist, I have used perl quite >> a bit in the past and I have found the "short and easy" way to do >> something is often not the supportable way. I often force myself to >> write the code out in the long form so that others after me can have a >> hope of understanding what I'm doing. > >Forget others that come after me. I find myself (regardless of the >language) using longer expressions of what I'm trying to do in the code >just so *I* have a hope of understanding what I'm doing (or trying to do). If I wanted to write write-only code that does a job in the least number of characters, I would probably pick Iverson's Language, aka APL. APL programmers seem to take pride in writing programs that nobody, including themselves, can figure out. My first experience with formatting code to show its structure was with Dartmouth ALGOL on G.E. Time Sharing in the late '60s. After learning ALGOL, I started formatting FORTRAN to indent things in emulation of ALGOL's block structure, and to make it easier to see what the program did. My perl code looks a lot like K&R C with similar indentation, long, descriptive variable names, and enough comments that I or somebody else can figure out what the program is supposed to do. One of my major problems with ALGOL and similar block structured languages with BEGIN/END block formatting has always been matching the corresponding terminators with the start of the blocks. This is true with *nix shells as well with if/fi, case/esac, and similar statement delimiters. Python's structure based on indentation does force one to a more readable style, and initially turned me off, mostly because I've been accustomed to using the vi(m) editor's ``%'' matching features extensively to navigate around code (and as many times as I've tried, I've never been able to learn emacs :-). My personal solution with python and shell scripting has been to add curly braces in comments so that I can then use vi's matching even though the underlying language doesn't use braces. This probably drives python purists nuts, but I find it very useful. I will often use expressions such as these: for i in range(8): #{ print i #} Or in the shell if test -d /directory; then #{{ # do something else #}{ # do something else fi #}} Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``If guns are outlawed, only the government will have guns. Only the police, the secret police, the military, the hired servants of our rulers. Only the government -- and a few outlaws. I intend to be among the outlaws.'' EDWARD ABBEY (1927-1989) From jarich at perltraining.com.au Thu Jun 14 17:01:06 2007 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Fri, 15 Jun 2007 10:01:06 +1000 Subject: SPUG: One Python users' view of Perl In-Reply-To: References: <003e01c7aec7$179bf450$0500a8c0@mlaptop> Message-ID: <4671D6C2.6070708@perltraining.com.au> Atom Powers wrote: > Perhaps a "best practices" document or a "crib sheet" of > common shortcuts would be useful. Something like Damian Conway's "Perl Best Practices" perhaps? http://www.oreilly.com/catalog/perlbp/ J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From andrew at sweger.net Thu Jun 14 20:26:27 2007 From: andrew at sweger.net (Andrew Sweger) Date: Thu, 14 Jun 2007 20:26:27 -0700 (PDT) Subject: SPUG: One Python users' view of Perl In-Reply-To: <4671C876.5000603@pcf.com> Message-ID: On Thu, 14 Jun 2007, Jules Agee wrote: > Andrew Sweger wrote: > > > > Forget others that come after me. I find myself (regardless of the > > language) using longer expressions of what I'm trying to do in the code > > just so *I* have a hope of understanding what I'm doing (or trying to do). > > Once I even resorted to adding a comment explaining what a piece of code > did. I really should not reply because I'm sure I'll just end up fanning some flames. But then my wife says I ain't that smart anyway... I like comments that give me hints on particularly dense or idiomatic *little* bits of code (and hope the comment stays in sync with the code!). The other kind of comments I like are like chapter headings for long procedural sections to help identify how the problem is broken down. Otherwise, I prefer to read the code itself since it's responsible for all the action. (I am _not_ referring to documentation or POD.) -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. From MichaelRWolf at att.net Thu Jun 14 20:41:38 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 14 Jun 2007 20:41:38 -0700 Subject: SPUG: double curlies [was RE: One Python users' view of Perl] In-Reply-To: <20070614232725.GA4848@ayn.mi.celestial.com> References: <20070614232725.GA4848@ayn.mi.celestial.com> Message-ID: <005601c7aeff$15279e80$0500a8c0@mlaptop> > if test -d /directory; then #{{ > # do something > else #}{ > # do something else > fi #}} Curlies++ Clever use of double curlies!! It makes great sense from the end of an else clause to go back to the beginning of the block or the controlling if. Neat idea. From MichaelRWolf at att.net Thu Jun 14 20:53:56 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 14 Jun 2007 20:53:56 -0700 Subject: SPUG: One Python users' view of Perl In-Reply-To: References: <4671C876.5000603@pcf.com> Message-ID: <005701c7af00$cd886f80$0500a8c0@mlaptop> What's your criteria for deciding whether to make better comments or refactor the code to be more readable? They both have merit. I'm interested what your balance point is. For example, I used to write code like this. return $counter++; # return the pre-incremented value 1 perl expression 1 sneaky 1 comment ----------- 3 cognitive chunks I now dispense with the idiom $original = $counter $counter++; return $original; 3 perl expressions 0 comments ---------- 3 cognitive chunks Zero chance that the comments are out of sync. With the introduction of a new variable to explicitly code what was otherwise implicit. I guess that in this case, if it's as easy to come up with good variable names, I'd prefer to introduce more Perl (in baby steps) than to try to capture that (less efficiently) in English. English was never designed to capture the kinds of nuance that Perl was designed to. I'll use Perl when I can, English when I have to. Of course, there's no added value to this kind of comment. I'm currently fighting this battle with a customer. It's my belief that we should comment the business logic, not the syntax. If the reader doesn't understand syntax (as appropriately formatted), comments are not likely to help enough to make them worth the clutter. if (condition) { block; . . . . } # end if -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net > -----Original Message----- > From: spug-list-bounces+michaelrwolf=att.net at pm.org [mailto:spug-list- > bounces+michaelrwolf=att.net at pm.org] On Behalf Of Andrew Sweger > Sent: Thursday, June 14, 2007 8:26 PM > To: Jules Agee > Cc: spug-list at pm.org > Subject: Re: SPUG: One Python users' view of Perl > > On Thu, 14 Jun 2007, Jules Agee wrote: > > > Andrew Sweger wrote: > > > > > > Forget others that come after me. I find myself (regardless of the > > > language) using longer expressions of what I'm trying to do in the > code > > > just so *I* have a hope of understanding what I'm doing (or trying to > do). > > > > Once I even resorted to adding a comment explaining what a piece of code > > did. > > I really should not reply because I'm sure I'll just end up fanning some > flames. But then my wife says I ain't that smart anyway... > > I like comments that give me hints on particularly dense or idiomatic > *little* bits of code (and hope the comment stays in sync with the code!). > The other kind of comments I like are like chapter headings for long > procedural sections to help identify how the problem is broken down. > Otherwise, I prefer to read the code itself since it's responsible for all > the action. (I am _not_ referring to documentation or POD.) > > -- > Andrew B. Sweger -- The great thing about multitasking is that several > things can go wrong at once. > > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ From offby1 at blarg.net Thu Jun 14 21:42:43 2007 From: offby1 at blarg.net (Eric Hanchrow) Date: Thu, 14 Jun 2007 21:42:43 -0700 Subject: SPUG: One Python users' view of Perl In-Reply-To: <005701c7af00$cd886f80$0500a8c0@mlaptop> (Michael R. Wolf's message of "Thu\, 14 Jun 2007 20\:53\:56 -0700") References: <005701c7af00$cd886f80$0500a8c0@mlaptop> Message-ID: <87abv1n7zw.fsf@offby1.atm01.sea.blarg.net> >>>>> "Michael" == Michael R Wolf writes: Michael> What's your criteria for deciding whether to make better Michael> comments or refactor the code to be more readable? They Michael> both have merit. I'm interested what your balance point Michael> is. I'm not sure I'm answering your question, but ... It seems most of the comments that I write explain why my code is more complex than you would naively expect it to be. My intent is that there's a good reason it's not simpler. When the code is as simple as one would naively expect, I rarely comment it. This is true of any language I write in, not just Perl. -- I do not wish to achieve immortality through my work. I wish to achieve it through not dying. -- Woody Allen From atom.powers at gmail.com Thu Jun 14 22:00:57 2007 From: atom.powers at gmail.com (Atom Powers) Date: Thu, 14 Jun 2007 22:00:57 -0700 Subject: SPUG: One Python users' view of Perl In-Reply-To: <005701c7af00$cd886f80$0500a8c0@mlaptop> References: <4671C876.5000603@pcf.com> <005701c7af00$cd886f80$0500a8c0@mlaptop> Message-ID: On 6/14/07, Michael R. Wolf wrote: > What's your criteria for deciding whether to make better comments or > refactor the code to be more readable? They both have merit. I'm > interested what your balance point is. I tend to add comments when the /purpose/ of the code isn't obvious and write the code verbosely when the /effect/ of the code isn't obvious. -- -- Perfection is just a word I use occasionally with mustard. --Atom Powers-- From m3047 at inwa.net Thu Jun 14 22:13:18 2007 From: m3047 at inwa.net (Fred Morris) Date: Thu, 14 Jun 2007 22:13:18 -0700 Subject: SPUG: One Python users' view of Perl In-Reply-To: <003e01c7aec7$179bf450$0500a8c0@mlaptop> References: <003e01c7aec7$179bf450$0500a8c0@mlaptop> Message-ID: <200706142213.18690.m3047@inwa.net> Hrmmm... hasn't the same criticism been made of english? But what about french? I would estimate your newfound friend had refuge in some unrelated ritual... and that's where you failed the test. On Thursday 14 June 2007 14:00, Michael R. Wolf wrote: > In a nutshell, he said that when he was looking at existing Perl code that > there were too many "idioms" ("non-obvious clever linguistic nuances", by my > reading of his intent) to learn in order to be effective. From bill at celestial.com Thu Jun 14 22:48:18 2007 From: bill at celestial.com (Bill Campbell) Date: Thu, 14 Jun 2007 22:48:18 -0700 Subject: SPUG: double curlies [was RE: One Python users' view of Perl] In-Reply-To: <005601c7aeff$15279e80$0500a8c0@mlaptop> References: <20070614232725.GA4848@ayn.mi.celestial.com> <005601c7aeff$15279e80$0500a8c0@mlaptop> Message-ID: <20070615054818.GA24593@ayn.mi.celestial.com> On Thu, Jun 14, 2007, Michael R. Wolf wrote: >> if test -d /directory; then #{{ >> # do something >> else #}{ >> # do something else >> fi #}} > >Curlies++ > >Clever use of double curlies!! It makes great sense from the end of an else >clause to go back to the beginning of the block or the controlling if. Neat >idea. Where it really is effective is when dealing with large numbers of elifs or try/except with many different exceptions. In python: try: #{{ commands here #} except someexception: #{ commands #} except anotherexceptin: #{ ... #}} I have code that handles very low-level keyboard input which traps exceptions for various function keys (pretty much any non-ascii input is an exception). Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``Whenever you find yourself on the side of the majority it is time to pause and reflect.'' -- Mark Twain From bill at celestial.com Thu Jun 14 23:39:46 2007 From: bill at celestial.com (Bill Campbell) Date: Thu, 14 Jun 2007 23:39:46 -0700 Subject: SPUG: Grep syntax Message-ID: <20070615063946.GA11017@ayn.mi.celestial.com> Speaking of documentation, or lack thereof. I just ran across a snippet of perl that I don't undertand at all. In this, the array @a contains octets of an IP address, and it appears that the authoer wanted to set $start0. As nears as I can tell after trying various contents of @a, $start0 is changed to 0 if there are *ANY* non-zero elements of the array @a. $start0=1; grep { $start0=0 unless $_ == 0; } @a; if ( ! $start0 ) { ... It appears to me that this is a rather cryptic way of checking that the array is empty or contains only 0 elements, and that the grep command could be replaced with map or a simple loop. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 http://www.celestial.com/ "I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forego their use." -- Galileo Galilei From scratchcomputing at gmail.com Fri Jun 15 00:20:41 2007 From: scratchcomputing at gmail.com (Eric Wilhelm) Date: Fri, 15 Jun 2007 00:20:41 -0700 Subject: SPUG: Grep syntax In-Reply-To: <20070615063946.GA11017@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com> Message-ID: <200706150020.41434.ewilhelm@cpan.org> # from Bill Campbell # on Thursday 14 June 2007 11:39 pm: >$start0=1; >grep { $start0=0 unless $_ == 0; } @a; > >if ( ! $start0 ) { ... ugh. Perhaps that means: my $start0 = ! grep({$_} @a); unless($start0) { ... But that's still awfully non-un-negatedified. if(grep({$_} @a)) { ... Isn't it? And wasn't this a discussion about how you can't do stupid stuff in python? There's nothing perlish about void-context greps and backwards negated logic. IME Perl requires you to do silly things less often than other languages. If the language supports it, you can just say what you mean. Reading code out loud (or to yourself) is always a good thing. The original code reads like "Set variable to true. Looping through list (wtf? grep makes no sense here!), uh, anyway... looping through list, make variable false unless the current element is false. Now if the variable is not true ... Uh, if ... uh nothing, no! something in the list was true, then it is false, no true, so ... now what? ... oh! if something in the list was true, then do this." Where the idiomatic code reads as: "if something in the list is true, do this." So, "idioms are good, bad code is bad", or something simple like that. --Eric -- Like a lot of people, I was mathematically abused as a child. --Paul Graham --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- From krahnj at telus.net Fri Jun 15 04:52:16 2007 From: krahnj at telus.net (John W. Krahn) Date: Fri, 15 Jun 2007 04:52:16 -0700 Subject: SPUG: Grep syntax In-Reply-To: <20070615063946.GA11017@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com> Message-ID: <46727D70.1020208@telus.net> Bill Campbell wrote: > Speaking of documentation, or lack thereof. > > I just ran across a snippet of perl that I don't undertand at > all. In this, the array @a contains octets of an IP address, and > it appears that the authoer wanted to set $start0. As nears as I > can tell after trying various contents of @a, $start0 is changed > to 0 if there are *ANY* non-zero elements of the array @a. > > $start0=1; > grep { $start0=0 unless $_ == 0; } @a; > > if ( ! $start0 ) { ... > > It appears to me that this is a rather cryptic way of checking > that the array is empty or contains only 0 elements, and that the > grep command could be replaced with map or a simple loop. Assuming that you are dealing with an IP addresse it would be simpler to use a regular expression: $start0 = $IP_addr =~ /^0+\.0+\.0+\.0+$/; Or you could even use Socket::inet_aton(): $start0 = inet_aton( $IP_addr ) eq "\0\0\0\0"; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From MichaelRWolf at att.net Fri Jun 15 08:29:42 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Fri, 15 Jun 2007 08:29:42 -0700 Subject: SPUG: Grep syntax In-Reply-To: <20070615063946.GA11017@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com> Message-ID: <008401c7af61$ffa83250$0500a8c0@mlaptop> Since Eric and John had to go to such effort to explain... *Two* comments on this section of code would have been great! One for the non-inverted-negated idiom. (Nice job unraveling the hair ball, Eric) One for the business logic (i.e. a non-trivial (0.0.0.0) IP address) -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From bill at celestial.com Fri Jun 15 09:28:11 2007 From: bill at celestial.com (Bill Campbell) Date: Fri, 15 Jun 2007 09:28:11 -0700 Subject: SPUG: Grep syntax In-Reply-To: <200706150020.41434.ewilhelm@cpan.org> References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> Message-ID: <20070615162811.GA10374@ayn.mi.celestial.com> On Fri, Jun 15, 2007, Eric Wilhelm wrote: ># from Bill Campbell ># on Thursday 14 June 2007 11:39 pm: > >>$start0=1; >>grep { $start0=0 unless $_ == 0; } @a; >> >>if ( ! $start0 ) { ... > >ugh. > >Perhaps that means: > > my $start0 = ! grep({$_} @a); > unless($start0) { ... > >But that's still awfully non-un-negatedified. > > if(grep({$_} @a)) { ... > >Isn't it? > >And wasn't this a discussion about how you can't do stupid stuff in >python? There's nothing perlish about void-context greps and backwards >negated logic. IME Perl requires you to do silly things less often >than other languages. If the language supports it, you can just say >what you mean. The author of the perl (Net::CIDR from CPAN) seems to like using grep as a method of processing arrays while doing no regular expression checking. He also does things like this to create an array, @bcopy, the same size as @b, populated with 255. This also takes advantage of perl's ``magic'' where looping through an array allows one to modify elements of the array by manipulating $_; my @bcopy = @b; grep { $_ = 255 } @bcopy; A python way of doing this is a bit less cryptic. This is similar to the perl method of expanding things like 'x' * n with python expanding the single element list into a list of length len(b) # Create array bcopy containing all 255 bcopy = [255] * len(b) ... Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software, LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``The fact is that the Constitution was intended to protect us from the government, and we cannot expect the government to enforce it willingly'' -- Dave E. Hoffmann, Reason Magazine March 2002 From MichaelRWolf at att.net Fri Jun 15 09:53:42 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Fri, 15 Jun 2007 09:53:42 -0700 Subject: SPUG: Grep syntax In-Reply-To: <20070615162811.GA10374@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com><200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> Message-ID: <00a101c7af6d$bb852630$0500a8c0@mlaptop> > my @bcopy = @b; > grep { $_ = 255 } @bcopy 'Ugh.... ' x 10 You mentioned the 'x' operator with a scalar LHS. With a list LHS, it behaves like the Python idiom you mentioned... my @bcopy = (255) x @b; Depending on the audience, I may write it like this: my $b_length = @b; my @bcopy = (255) x $b_length; Oh yeah, and come up with a better name for @bcopy. > # Create array bcopy containing all 255 > bcopy = [255] * len(b) From pmichaud at u.washington.edu Fri Jun 15 09:53:09 2007 From: pmichaud at u.washington.edu (Patrick Michaud) Date: Fri, 15 Jun 2007 09:53:09 -0700 (PDT) Subject: SPUG: Grep syntax In-Reply-To: <20070615162811.GA10374@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> Message-ID: Fortunately, perl allows for something along the lines of my @foo = (1,2,3,4); my @foocopy = (255) x @foo; warn join(',', @foocopy); or perhaps more clearly: my @foo = (1,2,3,4); my @foocopy = (255) x scalar(@foo); warn join(',', @foocopy); Some (quite a few, perhaps) perl authors have an unnatural love for grep and $_, but it doesn't need to be that way. -Patrick On Fri, 15 Jun 2007, Bill Campbell wrote: > On Fri, Jun 15, 2007, Eric Wilhelm wrote: >> # from Bill Campbell >> # on Thursday 14 June 2007 11:39 pm: >> >>> $start0=1; >>> grep { $start0=0 unless $_ == 0; } @a; >>> >>> if ( ! $start0 ) { ... >> >> ugh. >> >> Perhaps that means: >> >> my $start0 = ! grep({$_} @a); >> unless($start0) { ... >> >> But that's still awfully non-un-negatedified. >> >> if(grep({$_} @a)) { ... >> >> Isn't it? >> >> And wasn't this a discussion about how you can't do stupid stuff in >> python? There's nothing perlish about void-context greps and backwards >> negated logic. IME Perl requires you to do silly things less often >> than other languages. If the language supports it, you can just say >> what you mean. > > The author of the perl (Net::CIDR from CPAN) seems to like using grep as a > method of processing arrays while doing no regular expression checking. He > also does things like this to create an array, @bcopy, the same size as @b, > populated with 255. This also takes advantage of perl's ``magic'' where > looping through an array allows one to modify elements of the array by > manipulating $_; > > my @bcopy = @b; > grep { $_ = 255 } @bcopy; > > A python way of doing this is a bit less cryptic. This is similar to the > perl method of expanding things like 'x' * n with python expanding the > single element list into a list of length len(b) > > # Create array bcopy containing all 255 > bcopy = [255] * len(b) > > ... > Bill > -- > INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software, LLC > URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way > FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 > > ``The fact is that the Constitution was intended to protect us from > the government, and we cannot expect the government to enforce it > willingly'' -- Dave E. Hoffmann, Reason Magazine March 2002 > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > From charles.e.derykus at boeing.com Fri Jun 15 10:03:44 2007 From: charles.e.derykus at boeing.com (DeRykus, Charles E) Date: Fri, 15 Jun 2007 10:03:44 -0700 Subject: SPUG: Grep syntax In-Reply-To: <20070615162811.GA10374@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com><200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> Message-ID: On Fri, Jun 15, 2007, Eric Wilhelm wrote: >> # from Bill Campbell >> # on Thursday 14 June 2007 11:39 pm: >> >> $start0=1; >> grep { $start0=0 unless $_ == 0; } @a; >> >> if ( ! $start0 ) { ... >> >> ugh. >> >> Perhaps that means: >> >> my $start0 = ! grep({$_} @a); >> unless($start0) { ... >> >> But that's still awfully non-un-negatedified. >> >> if(grep({$_} @a)) { ... >> >> Isn't it? >> >> And wasn't this a discussion about how you can't do stupid stuff in >> python? There's nothing perlish about void-context greps and backwards >> negated logic. IME Perl requires you to do silly things less often >> than other languages. If the language supports it, you can just say >> what you mean. I tend to agree although there have been several conterpoints in the Perl newsgroup about void context.. Someone pointed out that 'print' for instance returns a success/fail flag and no one ever looks at it :). I think T.von Parseval even submitted a patch to make 'grep' context- aware so there was no longer any efficiency issue. Still seems like unnatural... > The author of the perl (Net::CIDR from CPAN) seems to like using grep as a method > of processing arrays while doing no regular expression checking. He also does > things like this to create an array, @bcopy, the same size as @b, populated with > 255. This also takes advantage of perl's ``magic'' where looping through an > array allows one to modify elements of the array by manipulating $_; > my @bcopy = @b; > grep { $_ = 255 } @bcopy; Ugh, that's so much easier to understand expanded in a simple loop even with a statement modifier: $_ = 255 for @bcopy; > A python way of doing this is a bit less cryptic. This is similar to the perl > method of expanding things like 'x' * n with python expanding the single element > list into a list of length len(b) > # Create array bcopy containing all 255 > bcopy = [255] * len(b) Not that there's anything wrong with that :) ... but I still prefer the statement modifier loop which seems so much more "English-like" to me. -- Charles DeRykus From krahnj at telus.net Fri Jun 15 10:09:55 2007 From: krahnj at telus.net (John W. Krahn) Date: Fri, 15 Jun 2007 10:09:55 -0700 Subject: SPUG: Grep syntax In-Reply-To: <20070615162811.GA10374@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> Message-ID: <4672C7E3.9040906@telus.net> Bill Campbell wrote: > > The author of the perl (Net::CIDR from CPAN) seems to like using grep as a > method of processing arrays while doing no regular expression checking. He > also does things like this to create an array, @bcopy, the same size as @b, > populated with 255. This also takes advantage of perl's ``magic'' where > looping through an array allows one to modify elements of the array by > manipulating $_; > > my @bcopy = @b; > grep { $_ = 255 } @bcopy; Or you could do that like this: $_ = 255 for my @bcopy = @b; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall From sthoenna at efn.org Fri Jun 15 12:39:45 2007 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Fri, 15 Jun 2007 12:39:45 -0700 (PDT) Subject: SPUG: Grep syntax In-Reply-To: <00a101c7af6d$bb852630$0500a8c0@mlaptop> References: <20070615063946.GA11017@ayn.mi.celestial.com><200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <00a101c7af6d$bb852630$0500a8c0@mlaptop> Message-ID: <42174.64.81.167.122.1181936385.squirrel@webmail.efn.org> On Fri, June 15, 2007 9:53 am, Michael R. Wolf wrote: > You mentioned the 'x' operator with a scalar LHS. > > With a list LHS, it behaves like the Python idiom you mentioned... > > my @bcopy = (255) x @b; Saying it that way ("With a list LHS") makes it sound like a violation of two rules: First, that operators provide context to their operands, not vice versa. The operator is what decides if what's on it's left is a list or a scalar. (For instance, my @bcopy = @b x 1; sets @bcopy to contain a single element whose value is the number of elements in @b, not a copy of all the elements in @b.) Second, related to the first, parentheses don't make a list. $x = (255) is no different than $x = 255. Since IMO it really helps to drive these rules deeply into learner's brains, my preferred explanation is that ()x is a different op than plain x, one that provides list context to it's right operand. ()= vs. = I also think of as two different ops. Unfortunately, over my protests, in 5.8.8, they made qw before x work as if it had parenthesis around it, so there's that glaring exception. Though = has a similar exception when it's left operand is an array or hash. From bill at celestial.com Fri Jun 15 12:55:36 2007 From: bill at celestial.com (Bill Campbell) Date: Fri, 15 Jun 2007 12:55:36 -0700 Subject: SPUG: Grep syntax In-Reply-To: <42174.64.81.167.122.1181936385.squirrel@webmail.efn.org> References: <20070615162811.GA10374@ayn.mi.celestial.com> <00a101c7af6d$bb852630$0500a8c0@mlaptop> <42174.64.81.167.122.1181936385.squirrel@webmail.efn.org> Message-ID: <20070615195536.GA9510@ayn.mi.celestial.com> On Fri, Jun 15, 2007, Yitzchak Scott-Thoennes wrote: >On Fri, June 15, 2007 9:53 am, Michael R. Wolf wrote: >> You mentioned the 'x' operator with a scalar LHS. >> >> With a list LHS, it behaves like the Python idiom you mentioned... >> >> my @bcopy = (255) x @b; > >Saying it that way ("With a list LHS") makes it sound like a violation >of two rules: > >First, that operators provide context to their operands, not vice versa. >The operator is what decides if what's on it's left is a list or a scalar. >(For instance, my @bcopy = @b x 1; sets @bcopy to contain a single element >whose value is the number of elements in @b, not a copy of all the elements >in @b.) > >Second, related to the first, parentheses don't make a list. $x = (255) >is no different than $x = 255. My bad. That was a typo. It should have been bcopy = [255] * len(a) I do use parenthesis on many expressions in python and perl to make it easier to find the end of statements with ``%'' in vi, and to eliminate the necessity of backwhacking continuation lines which is prone to mysterious errors if one has whitespace beyond the ``\'' character. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software, LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``The meek shall inherit the Earth, the rest of us will go to the stars...'' -Dr. Isaac Asimov From bill at celestial.com Fri Jun 15 13:09:12 2007 From: bill at celestial.com (Bill Campbell) Date: Fri, 15 Jun 2007 13:09:12 -0700 Subject: SPUG: Grep syntax In-Reply-To: <4672C7E3.9040906@telus.net> References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> Message-ID: <20070615200912.GA9641@ayn.mi.celestial.com> On Fri, Jun 15, 2007, John W. Krahn wrote: >Bill Campbell wrote: >> >> The author of the perl (Net::CIDR from CPAN) seems to like using grep as a >> method of processing arrays while doing no regular expression checking. He >> also does things like this to create an array, @bcopy, the same size as @b, >> populated with 255. This also takes advantage of perl's ``magic'' where >> looping through an array allows one to modify elements of the array by >> manipulating $_; >> >> my @bcopy = @b; >> grep { $_ = 255 } @bcopy; > >Or you could do that like this: > >$_ = 255 for my @bcopy = @b; My biggest problem with this is that, without comments, many people wouldn't realize that ``$_ = 255'' in this loop context is modifying the contents of the @bcopy array. I must admit that I've used this ``feature'' of perl many times, but I don't find it intuitively obvious. Would bcopy still exist outside of this statement? I would think that the ``my'' in the loop would be interpreted as local to the loop. I tend to write code defensively, and break things into steps to be sure that the language is doing what I want, something like this: my @bcopy = (); for (@b) { push(@bcopy, 255); } There's no possible ambiguity with this. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``I have no reason to suppose that he, who would take away my Liberty, would not when he had me in his Power, take away everything else.'' John Locke From iheffner at gmail.com Fri Jun 15 23:07:51 2007 From: iheffner at gmail.com (Ivan Heffner) Date: Fri, 15 Jun 2007 23:07:51 -0700 Subject: SPUG: Grep syntax In-Reply-To: <20070615200912.GA9641@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> <20070615200912.GA9641@ayn.mi.celestial.com> Message-ID: All of this talk (and disdain) for grep. Why? And no one has mentioned it's counterpart: map my @b_copy = map { 255 } @b; I believe that is about as clear as it gets. No worries about scope. No use of modification of an array in place. I know that the ()x idiom does the same thing. Unfortunately, my mind pulls map and grep up more readily than the x operator and when it does, I usually have to test whether I have the context correct for what I'm trying to do. map is very unambiguous: it always takes a list and always returns a list. (Now is when Yitzchak or Josh ben Jore will tell me how I'm wrong....) Ivan P.S. - I've really enjoyed the last couple of active threads on this list. I like to see the discussions and see what various opinions are in the community. Thanks to everyone for sharing. On 6/15/07, Bill Campbell wrote: > > On Fri, Jun 15, 2007, John W. Krahn wrote: > >Bill Campbell wrote: > >> > >> The author of the perl (Net::CIDR from CPAN) seems to like using grep > as a > >> method of processing arrays while doing no regular expression > checking. He > >> also does things like this to create an array, @bcopy, the same size as > @b, > >> populated with 255. This also takes advantage of perl's ``magic'' > where > >> looping through an array allows one to modify elements of the array by > >> manipulating $_; > >> > >> my @bcopy = @b; > >> grep { $_ = 255 } @bcopy; > > > >Or you could do that like this: > > > >$_ = 255 for my @bcopy = @b; > > My biggest problem with this is that, without comments, many people > wouldn't realize that ``$_ = 255'' in this loop context is modifying the > contents of the @bcopy array. I must admit that I've used this > ``feature'' > of perl many times, but I don't find it intuitively obvious. > > Would bcopy still exist outside of this statement? I would think that the > ``my'' in the loop would be interpreted as local to the loop. > > I tend to write code defensively, and break things into steps to be sure > that the language is doing what I want, something like this: > > my @bcopy = (); > for (@b) { > push(@bcopy, 255); > } > > There's no possible ambiguity with this. > > Bill > -- > INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC > URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way > FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) > 236-1676 > > ``I have no reason to suppose that he, who would take away my Liberty, > would > not when he had me in his Power, take away everything else.'' John Locke > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/spug-list/attachments/20070615/5c6d4adc/attachment.html From bill at celestial.com Fri Jun 15 23:32:59 2007 From: bill at celestial.com (Bill Campbell) Date: Fri, 15 Jun 2007 23:32:59 -0700 Subject: SPUG: Grep syntax In-Reply-To: References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> <20070615200912.GA9641@ayn.mi.celestial.com> Message-ID: <20070616063259.GA9774@ayn.mi.celestial.com> On Fri, Jun 15, 2007, Ivan Heffner wrote: > > All of this talk (and disdain) for grep. Why? > And no one has mentioned it's counterpart: map > my @b_copy = map { 255 } @b; My original request was (a) to try to figure out why somebody would use grep in a manner that wasn't about pattern recognition, but used for looping, and (b) I think I said that map would be a more logical choice for that. I was attempting to figure out what the author of the Net::CIDR package was doing. ... Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software, LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 Democracy must be sometihng more than two wolves and a sheep voting on what to have for dinner -- James Bovard From m3047 at inwa.net Sat Jun 16 00:06:45 2007 From: m3047 at inwa.net (Fred Morris) Date: Sat, 16 Jun 2007 00:06:45 -0700 Subject: SPUG: truth Re: Grep syntax In-Reply-To: <42174.64.81.167.122.1181936385.squirrel@webmail.efn.org> References: <20070615063946.GA11017@ayn.mi.celestial.com> <00a101c7af6d$bb852630$0500a8c0@mlaptop> <42174.64.81.167.122.1181936385.squirrel@webmail.efn.org> Message-ID: <200706160006.45493.m3047@inwa.net> True true true! Now: "behaves"? Is there a Perl or Python operator which evaluates that? (Oh, bother. Exceptions and all that.) I think there is a constant tension between language formalists and those who attempt to utilize a language for expressive purposes (hence frameworks, APIs, scaffolds and so forth). When this tension is X, Y things happen. On Friday 15 June 2007 12:39, Yitzchak Scott-Thoennes wrote: > On Fri, June 15, 2007 9:53 am, Michael R. Wolf wrote: > > You mentioned the 'x' operator with a scalar LHS. > > > > With a list LHS, it behaves like the Python idiom you mentioned... > > > > my @bcopy = (255) x @b; > > Saying it that way ("With a list LHS") makes it sound like a violation > of two rules: > > First, that operators provide context to their operands, not vice versa. > The operator is what decides if what's on it's left is a list or a scalar. > (For instance, my @bcopy = @b x 1; sets @bcopy to contain a single element > whose value is the number of elements in @b, not a copy of all the elements > in @b.) > > Second, related to the first, parentheses don't make a list. $x = (255) > is no different than $x = 255. > From shawnw at speakeasy.org Sat Jun 16 00:39:59 2007 From: shawnw at speakeasy.org (Shawn W.) Date: Sat, 16 Jun 2007 00:39:59 -0700 Subject: SPUG: Grep syntax In-Reply-To: References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> <20070615200912.GA9641@ayn.mi.celestial.com> Message-ID: On Jun 15, 2007, at 11:07 PM, Ivan Heffner wrote: > All of this talk (and disdain) for grep. Why? > > And no one has mentioned it's counterpart: map > I suspect a lot of perl users don't have a great deal of familiarity with functional languages where list processing is emphasized than it is in perl -- lisp, scheme, the MLs, and so on. map, filter/grep, and one that perl's missing as a built-in -- fold (which can be used to create pretty much any other list function) are used all over the place in those languages. Not so much in perl, though not for technical reasons. People get into a certain mindset of how to do something and just don't think of alternatives using other paradigms or idioms. -- Shawn W. shawnw at speakeasy.org From sthoenna at efn.org Sat Jun 16 22:45:55 2007 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Sat, 16 Jun 2007 22:45:55 -0700 (PDT) Subject: SPUG: Grep syntax In-Reply-To: <20070616063259.GA9774@ayn.mi.celestial.com> References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> <20070615200912.GA9641@ayn.mi.celestial.com> <20070616063259.GA9774@ayn.mi.celestial.com> Message-ID: <59511.71.35.108.198.1182059155.squirrel@webmail.efn.org> On Fri, June 15, 2007 11:32 pm, Bill Campbell wrote: > My original request was (a) to try to figure out why somebody > would use grep in a manner that wasn't about pattern recognition, but used > for looping, and (b) I think I said that map would be a more logical > choice for that. grep, used in the normal way, is about list selection. Pattern recognition is one common way of doing that selection, but seeing grep used in other ways shouldn't be a surprise. For instance, one way of finding the keys two hashes have in common is: @common_keys = grep exists $hash2{$_}, keys %hash1; From sthoenna at efn.org Sat Jun 16 22:56:37 2007 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Sat, 16 Jun 2007 22:56:37 -0700 (PDT) Subject: SPUG: Grep syntax In-Reply-To: References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> <20070615200912.GA9641@ayn.mi.celestial.com> Message-ID: <44094.71.35.108.198.1182059797.squirrel@webmail.efn.org> On Sat, June 16, 2007 12:39 am, Shawn W. wrote: > I suspect a lot of perl users don't have a great deal of familiarity > with functional languages where list processing is emphasized than it is in > perl -- lisp, scheme, the MLs, and so on. map, filter/grep, and one that > perl's missing as a built-in -- fold (which can be used to create pretty > much any other list function) are used all over the place in those > languages. What would a perl equivalent of fold look like? A lot of useful stuff in perl isn't built in. The core module List::Util is invaluable. From CPAN, there's lots of handy things in Algorithm::Loops and List::MoreUtils. From twists at gmail.com Sun Jun 17 12:00:58 2007 From: twists at gmail.com (Joshua ben Jore) Date: Sun, 17 Jun 2007 12:00:58 -0700 Subject: SPUG: Grep syntax In-Reply-To: <44094.71.35.108.198.1182059797.squirrel@webmail.efn.org> References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> <20070615200912.GA9641@ayn.mi.celestial.com> <44094.71.35.108.198.1182059797.squirrel@webmail.efn.org> Message-ID: On 6/16/07, Yitzchak Scott-Thoennes wrote: > On Sat, June 16, 2007 12:39 am, Shawn W. wrote: > > I suspect a lot of perl users don't have a great deal of familiarity > > with functional languages where list processing is emphasized than it is in > > perl -- lisp, scheme, the MLs, and so on. map, filter/grep, and one that > > perl's missing as a built-in -- fold (which can be used to create pretty > > much any other list function) are used all over the place in those > > languages. > > What would a perl equivalent of fold look like? > > A lot of useful stuff in perl isn't built in. The core module > List::Util is invaluable. From CPAN, there's lots of handy things > in Algorithm::Loops and List::MoreUtils. I question slightly the necessity of fold() in Perl 5. During much of my recent exposure to list based languages, lists all seem to be constructed of pairs. foldl and foldr are naturals in this case because the atomic list element is a pair. In perl, lists are either a single entity on the stack or a single entity in an array. We do not have the "pair" concept. You can of course implement pairs and do many pair-wise things in perl but it's against the grain. Of course, in Perl 5 we still have lots of binary operators which is why List::Util's reduce() function is spiffy. It's just foldl. For unary operators the map builtin suffices. In these two cases there's a tension between the idea of lists as whole entities and lists as linked pairs. Most of our tools still operate in a pair-wise manner but in theory... Perl 5 could have Perl 6's reduction metaoperator. I'd also note that Perl 6 is getting away from a single binary fold operator. The reduction operator (http://dev.perl.org/perl6/doc/design/syn/S03.html) allows binary operators like '+' to be promoted to an N-ary operator. [+], ELT0, ELT1, ELT2, ELT3 becomes ELT0 + ELT1 + ELT2 + ELT3 Whether this is done as foldl or foldr depends on the associativity of the operator. Perhaps then this does make foldl and foldr necessary because you may want to choose one explicitly for memory reasons. Something to note, Perl 6's reduction operator could in theory be mixed associative if it's under the influence of strange data and untoward intent. Josh From Perl at Doorways.org Sun Jun 17 21:47:24 2007 From: Perl at Doorways.org (Marc M. Adkins) Date: Sun, 17 Jun 2007 21:47:24 -0700 Subject: SPUG: Grep syntax In-Reply-To: References: <20070615063946.GA11017@ayn.mi.celestial.com> <200706150020.41434.ewilhelm@cpan.org> <20070615162811.GA10374@ayn.mi.celestial.com> <4672C7E3.9040906@telus.net> <20070615200912.GA9641@ayn.mi.celestial.com> Message-ID: <46760E5C.20908@Doorways.org> Shawn W. wrote: > On Jun 15, 2007, at 11:07 PM, Ivan Heffner wrote: > >> All of this talk (and disdain) for grep. Why? >> >> And no one has mentioned it's counterpart: map >> > > I suspect a lot of perl users don't have a great deal of familiarity > with functional languages where list processing is emphasized than it > is in perl -- lisp, scheme, the MLs, and so on. map, filter/grep, > and one that perl's missing as a built-in -- fold (which can be used > to create pretty much any other list function) are used all over the > place in those languages. Not so much in perl, though not for > technical reasons. People get into a certain mindset of how to do > something and just don't think of alternatives using other paradigms > or idioms. LOL. One of the reasons I enjoy Perl is that it reminds me of Lisp. It's a little bit of a stretch, but think about map and grep, eval, and the minimal but entirely sufficient support for objects. Not to mention productivity, measured as getting the job done in minimal time. I so miss InterLisp. Anyone have an old Xerox 110X box laying around gathering dust? Marc M. Adkins From dwilburn at whitepages.com Mon Jun 18 17:31:11 2007 From: dwilburn at whitepages.com (Daina Wilburn) Date: Mon, 18 Jun 2007 17:31:11 -0700 Subject: SPUG: REMINDER: Meeting Announcement -- 19 June, 2007 Message-ID: <99EC30D21F5A8A44B1369983D2D952997190E7@netmail.corp.w3data.com> REMINDER: TOMORROW, TUESDAY, JUNE 19 IS THE: June 2007 Seattle Perl Users Group (SPUG) Meeting ==================================================== Topic: Python for Perl Mongers Speaker: Bill Campbell of Celestial Software, LLC Meeting Date: Tuesday, 19 June 2007 Meeting Time: 6:30 - 8:30 p.m. Location: Whitepages.com offices, downtown Seattle Cost: Admission is free and open to the public Info: http://seattleperl.org/ ==================================================== This coming Tuesday, June 19th, should bring out the beast, I mean BEST in us all, as we come together once again for the monthly meeting of ....... (dun da da dun!....) THE SEATTLE PERL USERS GROUP! (APPLAUSE) (thanks) This month Bill Campbell of Celestial Software (http://www.celestial.com) will be giving a very interesting talk on "Python for Perl Mongers". Here's an outline of the discussion: - [ ] Python for Perl mongers. - [ ] Introduction and background - [ ] Documentation - [ ] Books - [ ] Perl to Python Migration by Martin C. Brown - [ ] Python Cookbook - [ ] On-line documentation - [ ] python reference - [ ] python library reference - [ ] Documentation in source - [ ] pydoc - [ ] Interactive testing - [ ] Program formatting - [ ] Indentation/Style ``steaming pile of dinosaur dung'' - [ ] Embedding curly braces in comments - [ ] Wrapping statements with parenthesis - [ ] Tabs vs space, potential problems - [ ] Variable types and syntax - [ ] Simple variables - [ ] strings - [ ] Must convert strings to other types - [ ] int and longs - [ ] float - [ ] decimal, fixedpoint - [ ] dictionaries/hashes - [ ] using the ``dict'' command to simplify definitions - [ ] Methods - [ ] copy - [ ] del - [ ] pop - [ ] update - [ ] lists and tuples - [ ] subscript syntax and operations - [ ] strings may be treated as immutable lists. - [ ] Tuples are immutable lists -- may be key to dictionaries - [ ] List methods - [ ] append - [ ] del - [ ] extend - [ ] index - [ ] insert - [ ] pop - [ ] Python syntax -- simple - [ ] No compound statements if(a = b)... - [ ] Minimal magic - [ ] Regular expressions -- perl standard - [ ] function definitions - [ ] parameters - [ ] must be declared - [ ] default values - [ ] *args - [ ] **kwargs - [ ] Returns - [ ] May contain sub functions and classes - [ ] Exception handling - [ ] Basic syntax - [ ] Creating exception classes - [ ] Standard library - [ ] Modular nature of python compared to perl - [ ] import package - [ ] from package import - [ ] Object Oriented Programming - [ ] Creating Classes - [ ] AUTOLOAD -- NOT! - [ ] attributes - [ ] methods - [ ] special methods - [ ] Modules - [ ] Building packages for installation - [ ] distutils - [ ] ezinstall -- not easy - [ ] Open source program sources Here's Bill's and Celestial's contact information: Bill Campbell; Celestial Software LLC PO Box 820; 6641 E. Mercer Way Mercer Island, WA 98040-0820; INTERNET: bill at Celestial.COM URL: http://www.celestial.com/ Phone: (206) 236-1676 FAX: (206) 232-9186 Thanks so much, Bill! We're looking forward to having you! (MORE APPLAUSE, PLEASE) (thanks again) So, come one and all! Remember to bring someone who hasn't ventured over before, and, of course, remember to bring yourself! Thanks again to all the SPUG members that show up at meetings or participate on the list to make the group worthwhile in the first place, and all the JAPHs out there for just being. Meeting Location ================ Whitepages.com is located on the 16th floor of the Rainier Square Tower (1301 5th Avenue, Seattle) which is across from the 5th Avenue Theater. See the directions[1] for a quick primer on how to reach us from various locations across Puget Sound. There are plenty of locations to park in the area, including on the street. If you're looking for off-street parking, you can park in the Rainier Square garage which has an entrance on Union St. After 6PM, the building management restricts access to most floors. Our host is trying to take care of this, but if unsuccessful, they will station someone on the 1st floor near the elevator bank and 5th Avenue entrance to let people in. Worst case scenario, give the host a call on his cell phone[2] or [3] and he'll run down to let you in. Our hosts are providing a generous assortment of free sodas, fruit drinks, teas, and coffee, and also have some snacks. You definitely won't dehydrate here. See you there! -DW [1] - http://www.whitepagesinc.com/locations [2] - 206 354 7789 - Colin Meyer [3] - 206-271-9267 - Daina Wilburn _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ From bill at celestial.com Tue Jun 19 09:45:05 2007 From: bill at celestial.com (Bill Campbell) Date: Tue, 19 Jun 2007 09:45:05 -0700 Subject: SPUG: Car pool from east side tonight? Message-ID: <20070619164505.GB19215@ayn.mi.celestial.com> Is anybody coming from the east side who is interested in meeting at a park and ride lot on Mercer Island to ride over and back? I think there's a Mariners game tonight so traffic is likely to be on the nasty side. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 My brother sent me a postcard the other day with this big satellite photo of the entire earth on it. On the back it said: ``Wish you were here''. -- Steven Wright From bill at celestial.com Tue Jun 19 09:45:05 2007 From: bill at celestial.com (Bill Campbell) Date: Tue, 19 Jun 2007 09:45:05 -0700 Subject: SPUG: Car pool from east side tonight? Message-ID: <20070619164505.GB19215@ayn.mi.celestial.com> Is anybody coming from the east side who is interested in meeting at a park and ride lot on Mercer Island to ride over and back? I think there's a Mariners game tonight so traffic is likely to be on the nasty side. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 My brother sent me a postcard the other day with this big satellite photo of the entire earth on it. On the back it said: ``Wish you were here''. -- Steven Wright From rjk-spug at tamias.net Wed Jun 20 19:31:00 2007 From: rjk-spug at tamias.net (Ronald J Kimball) Date: Wed, 20 Jun 2007 22:31:00 -0400 Subject: SPUG: Ride to Oscon? Message-ID: <20070621023100.GC83038@penkwe.pair.com> Hello. I'm a Perl Monger from Boston. I'm going to be out there for Oscon next month, but I'll be visiting my sister in Seattle for a few days first. I was wondering if anyone will be driving to Portland on Tuesday, July 4, and would have room for an extra passenger. I could pay for gas or dinner or something else agreeable. If I don't find anyone, I'll just take Amtrak, but I think it would be more fun to share a drive. thanks! Ronald From cxreg at pobox.com Thu Jun 21 12:53:33 2007 From: cxreg at pobox.com (Dave O) Date: Thu, 21 Jun 2007 14:53:33 -0500 (CDT) Subject: SPUG: Ride to Oscon? In-Reply-To: <20070621023100.GC83038@penkwe.pair.com> References: <20070621023100.GC83038@penkwe.pair.com> Message-ID: The next "Tuesday, July 4" is in 2017 :) Do you mean Wednesday, July 4th (a little early perhaps?) or maybe Monday, July 24th (when the conference begins)? Maybe Tuesday, July 25th? On Wed, 20 Jun 2007, Ronald J Kimball wrote: > Hello. I'm a Perl Monger from Boston. I'm going to be out there for Oscon > next month, but I'll be visiting my sister in Seattle for a few days first. > I was wondering if anyone will be driving to Portland on Tuesday, July 4, > and would have room for an extra passenger. I could pay for gas or dinner > or something else agreeable. > > If I don't find anyone, I'll just take Amtrak, but I think it would be more > fun to share a drive. > > thanks! > Ronald > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > > > From cxreg at pobox.com Thu Jun 21 13:06:09 2007 From: cxreg at pobox.com (Dave O) Date: Thu, 21 Jun 2007 15:06:09 -0500 (CDT) Subject: SPUG: Ride to Oscon? In-Reply-To: References: <20070621023100.GC83038@penkwe.pair.com> Message-ID: Oops, the 24th is a Tuesday, presumably you meant that day. On Thu, 21 Jun 2007, Dave O wrote: > The next "Tuesday, July 4" is in 2017 :) Do you mean Wednesday, July 4th > (a little early perhaps?) or maybe Monday, July 24th (when the conference > begins)? Maybe Tuesday, July 25th? > > On Wed, 20 Jun 2007, Ronald J Kimball wrote: > > > Hello. I'm a Perl Monger from Boston. I'm going to be out there for Oscon > > next month, but I'll be visiting my sister in Seattle for a few days first. > > I was wondering if anyone will be driving to Portland on Tuesday, July 4, > > and would have room for an extra passenger. I could pay for gas or dinner > > or something else agreeable. > > > > If I don't find anyone, I'll just take Amtrak, but I think it would be more > > fun to share a drive. > > > > thanks! > > Ronald > > _____________________________________________________________ > > Seattle Perl Users Group Mailing List > > POST TO: spug-list at pm.org > > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > > MEETINGS: 3rd Tuesdays > > WEB PAGE: http://seattleperl.org/ > > > > > > > _____________________________________________________________ > Seattle Perl Users Group Mailing List > POST TO: spug-list at pm.org > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list > MEETINGS: 3rd Tuesdays > WEB PAGE: http://seattleperl.org/ > > > From rjk-spug at tamias.net Thu Jun 21 13:06:54 2007 From: rjk-spug at tamias.net (Ronald J Kimball) Date: Thu, 21 Jun 2007 16:06:54 -0400 Subject: SPUG: Ride to Oscon? In-Reply-To: References: <20070621023100.GC83038@penkwe.pair.com> Message-ID: <20070621200654.GB46334@penkwe.pair.com> On Thu, Jun 21, 2007 at 02:53:33PM -0500, Dave O wrote: > The next "Tuesday, July 4" is in 2017 :) Do you mean Wednesday, July 4th > (a little early perhaps?) or maybe Monday, July 24th (when the conference > begins)? Maybe Tuesday, July 25th? Oops. I meant Tuesday, July 24th. (Not the 25th, which is Wednesday.) thanks, Ronald From cos at indeterminate.net Thu Jun 21 14:50:40 2007 From: cos at indeterminate.net (John Costello) Date: Thu, 21 Jun 2007 14:50:40 -0700 (PDT) Subject: SPUG: Ride to Oscon? In-Reply-To: <20070621023100.GC83038@penkwe.pair.com> Message-ID: On Wed, 20 Jun 2007, Ronald J Kimball wrote: > If I don't find anyone, I'll just take Amtrak, but I think it would be more > fun to share a drive. If you take Amtrak, $5-10 extra upgrades you to business class, which is roomier and has convenient plugs for laptops. You also get some kind of food voucher thingy. From bill at celestial.com Thu Jun 21 15:05:47 2007 From: bill at celestial.com (Bill Campbell) Date: Thu, 21 Jun 2007 15:05:47 -0700 Subject: SPUG: Ride to Oscon? In-Reply-To: References: <20070621023100.GC83038@penkwe.pair.com> Message-ID: <20070621220547.GA21716@ayn.mi.celestial.com> On Thu, Jun 21, 2007, John Costello wrote: >On Wed, 20 Jun 2007, Ronald J Kimball wrote: >> If I don't find anyone, I'll just take Amtrak, but I think it would be more >> fun to share a drive. > >If you take Amtrak, $5-10 extra upgrades you to business class, which is >roomier and has convenient plugs for laptops. You also get some kind of >food voucher thingy. Train service from Seattle to Portland is reasonably reliable, but the Portland to Seattle trains are commonly hours late. Their excuse is that the Northbound trains start in California and ar subject to delays. I would think that they would have figured out how to meet a schedule after a hundred years or so. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 Instead of giving money to found colleges to promote learning, why don't they pass a constitutional amendment prohibiting anybody from learning anything? If it works as good as the Prohibition one did, why, in five years we would have the smartest race of people on earth. -- The Best of Will Rogers From yahgrp at poplarware.com Thu Jun 21 15:19:14 2007 From: yahgrp at poplarware.com (Jennifer Hodgdon) Date: Thu, 21 Jun 2007 15:19:14 -0700 Subject: SPUG: Ride to Oscon? In-Reply-To: <20070621220547.GA21716@ayn.mi.celestial.com> References: <20070621023100.GC83038@penkwe.pair.com> <20070621220547.GA21716@ayn.mi.celestial.com> Message-ID: <467AF962.7090601@poplarware.com> Bill Campbell wrote: > Train service from Seattle to Portland is reasonably reliable, but the > Portland to Seattle trains are commonly hours late. Their excuse is that > the Northbound trains start in California and ar subject to delays. I > would think that they would have figured out how to meet a schedule after a > hundred years or so. There is only one train per day that comes from California. The rest either start in Eugene OR or Portland, and they tend to be on time. The key is to make sure you are signed up to take the "Amtrak Cascades" trains and avoid the "Coast Starlight". Actually, the Coast Starlight is frequently slow/delayed in the southbound direction as well. -- Jennifer -- Jennifer Hodgdon Poplar ProductivityWare * www.poplarware.com Web Databases/Scripts * Modeling/Analysis/Palm OS Software From MichaelRWolf at att.net Thu Jun 21 19:23:45 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 21 Jun 2007 19:23:45 -0700 Subject: SPUG: On clocks, synchronous packets, and trains In-Reply-To: <20070621220547.GA21716@ayn.mi.celestial.com> References: <20070621023100.GC83038@penkwe.pair.com> <20070621220547.GA21716@ayn.mi.celestial.com> Message-ID: <002e01c7b474$6300c7b0$0500a8c0@mlaptop> > I would think that they would have figured out how to meet a schedule > after a hundred years or so. Trains were, in fact, the driver of coordinated time, and chronographs (expensive watches) were the cutting edge in the high tech of the era. Without any other means of communication (i.e. before radios), reliance on schedules was critical to prevent half-duplex resource contention (i.e. two trains on the same track in opposite directions). The schedules worked only worked if everyone in the system agreed on what time it was, something that hadn't previously been important. A conductor's watch provided the synchronization, and was therefore the high tech gadget that, along with other SOP's (i.e. error detection and correction algorithms) prevented collisions. Up until this time, folks in New York didn't usually care if their clock towers were in synch with the ones in Philadelphia or Baltimore. Once the railroad corridor opened, it was a matter of life and death. Another big push toward creating a universal time was the digital telephone networks. Timing bits in asynchronous communications represented lost bandwidth since they were transmitted in-band. Creating an out-of-band time reference allowed synchronous communications across long distances (i.e. New York to Washington) to prevent packet collision. Not nearly as spectacular as locomotive collisions, but important, nevertheless!!! -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From bill at celestial.com Thu Jun 21 20:45:11 2007 From: bill at celestial.com (Bill Campbell) Date: Thu, 21 Jun 2007 20:45:11 -0700 Subject: SPUG: On clocks, synchronous packets, and trains In-Reply-To: <002e01c7b474$6300c7b0$0500a8c0@mlaptop> References: <20070621220547.GA21716@ayn.mi.celestial.com> <002e01c7b474$6300c7b0$0500a8c0@mlaptop> Message-ID: <20070622034511.GB21304@ayn.mi.celestial.com> On Thu, Jun 21, 2007, Michael R. Wolf wrote: >> I would think that they would have figured out how to meet a schedule >> after a hundred years or so. > >Trains were, in fact, the driver of coordinated time, and chronographs >(expensive watches) were the cutting edge in the high tech of the era. > >Without any other means of communication (i.e. before radios), reliance on >schedules was critical to prevent half-duplex resource contention (i.e. two >trains on the same track in opposite directions). While I understand the idea, I don't think it was that important with rail roads in the U.S. South as trains tended to stop at practically every cow pasture. ... >Another big push toward creating a universal time was the digital telephone >networks. Timing bits in asynchronous communications represented lost >bandwidth since they were transmitted in-band. Creating an out-of-band time >reference allowed synchronous communications across long distances (i.e. New >York to Washington) to prevent packet collision. Not nearly as spectacular >as locomotive collisions, but important, nevertheless!!! My grandmother always claimed that the wreck of the Old 97 occurred on our family's farm near Danville, Virginia which may be why stewed tomatoes at our house were always called ``train wreck''. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``Whenever you find yourself on the side of the majority it is time to pause and reflect.'' -- Mark Twain From MichaelRWolf at att.net Thu Jun 21 21:34:08 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 21 Jun 2007 21:34:08 -0700 Subject: SPUG: double quotes vs printf Message-ID: <004f01c7b486$96cb1f20$0500a8c0@mlaptop> When I've got to print a long string with variable interpolation, I often rewrite print " Lorem ipsum dolor sit $var1, consectetuer adipiscing $var2. In felis"; with printf 'Lorem ipsum dolor sit %s, consectetuer adipiscing %s. In felis', $var1, $var2; or even my $fmt = 'Lorem ipsum dolor sit %s, consectetuer adipiscing %s. In felis' printf $fmt, $var1, $var2; I think it separates the presentation from the content. I can save the older/stupider (i.e. me, later) reader from having to parse and interpolate the format string by factoring it out of the print, and signaling the same by surrounding it with single (non-interpolating) quotes. I haven't seen wide spread use of this refactoring. Have you? What's your opinion of this practice? Although I've seen folks replace comma with fat-comma, I don't like it. Guess fat-comma feels too much like a duple to me. printf $fmt => $var1, $var2; -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From bill at celestial.com Thu Jun 21 21:47:46 2007 From: bill at celestial.com (Bill Campbell) Date: Thu, 21 Jun 2007 21:47:46 -0700 Subject: SPUG: double quotes vs printf In-Reply-To: <004f01c7b486$96cb1f20$0500a8c0@mlaptop> References: <004f01c7b486$96cb1f20$0500a8c0@mlaptop> Message-ID: <20070622044746.GA11676@ayn.mi.celestial.com> On Thu, Jun 21, 2007, Michael R. Wolf wrote: >When I've got to print a long string with variable interpolation, I often >rewrite > >print " Lorem ipsum dolor sit $var1, consectetuer adipiscing $var2. In >felis"; > >with > > printf 'Lorem ipsum dolor sit %s, consectetuer adipiscing %s. In felis', > $var1, $var2; > >or even > > my $fmt = 'Lorem ipsum dolor sit %s, consectetuer adipiscing %s. In felis' > printf $fmt, $var1, $var2; > >I think it separates the presentation from the content. I can save the >older/stupider (i.e. me, later) reader from having to parse and interpolate >the format string by factoring it out of the print, and signaling the same >by surrounding it with single (non-interpolating) quotes. Personally I prefer using the variable expansion in perl as I find it easier to see what's being done than to have to match the format string with the variables in the argument list. If one wants to use more detailled format specs (e.g. %8.2f), variable expansion doesn't work unless the variable contains the formatted string. Bill -- INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``Our Foreign dealings are an Open Book, generally a Check Book.'' Will Rogers From MichaelRWolf at att.net Thu Jun 21 23:18:31 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Thu, 21 Jun 2007 23:18:31 -0700 Subject: SPUG: double quotes vs printf In-Reply-To: <20070622044746.GA11676@ayn.mi.celestial.com> References: <004f01c7b486$96cb1f20$0500a8c0@mlaptop> <20070622044746.GA11676@ayn.mi.celestial.com> Message-ID: <005601c7b495$29406000$0500a8c0@mlaptop> > If one wants to use more detailled format specs (e.g. %8.2f), > variable expansion doesn't work unless the variable contains the > formatted string. Yup! Perhaps you brought up a better example of why I like to separate the how(presentation) from the what(data).... my $line_item_fmt = 'Qty: %3d Unit Price: $%7.2f Extended Price: $%7.2f'; print $line_item_fmt, $qty, $unit_price, $qty * $unit_price; -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From rjk-spug at tamias.net Fri Jun 22 07:52:00 2007 From: rjk-spug at tamias.net (Ronald J Kimball) Date: Fri, 22 Jun 2007 10:52:00 -0400 Subject: SPUG: double quotes vs printf In-Reply-To: <004f01c7b486$96cb1f20$0500a8c0@mlaptop> References: <004f01c7b486$96cb1f20$0500a8c0@mlaptop> Message-ID: <20070622145159.GA9447@penkwe.pair.com> Keep in mind that, unlike print, printf does not append the value of $\ to the output. Ronald From MichaelRWolf at att.net Fri Jun 22 09:35:01 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Fri, 22 Jun 2007 09:35:01 -0700 Subject: SPUG: stand-alone mini-CPAN on a read-only CD Message-ID: <00e501c7b4eb$48a055d0$0500a8c0@mlaptop> For a few years, I have had a complete, stand-alone mini CPAN on my laptop. Thanks to Randal Schwartz for the original article that prompted me to set it up! http://www.stonehenge.com/merlyn/LinuxMag/col42.html http://search.cpan.org/search?query=minicpan&mode=all I've got a one-liner that helps me remember the options: minicpan -r http://www.perl.com/CPAN/ -l /CPAN-mini /CPAN-mini currently consumes 673M. It's great for times when I'm *not* connected to the internet. (Oh the horrors of a road-warrior, Perl evangelist...) I'd like to make self-contained CD's that I can hand out in class, or even use in class without relying on internet connectivity. To my thinking, this would require running the cpan command (just perl -MCPAN -eshell) and specifying the config parameters without having to rely running config and writing back to the perl5/5.8/CPAN/Config.pm file (or ~/.cpan/CPAN/MyConfig.pm). Has anyone pulled apart the hairball that is CPAN.pm and CPAN/Config.pm enough to write a self-contained, CD-only, read-only version of the cpan shell? Extra points if it can figure out the root of the CD and add it to the urllist config parameter as something like file:///CPAN-mini. Extra points if that code is smart enough to work on linux and also on Windows. -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net From cos at indeterminate.net Fri Jun 22 09:54:23 2007 From: cos at indeterminate.net (John Costello) Date: Fri, 22 Jun 2007 09:54:23 -0700 (PDT) Subject: SPUG: Ride to Oscon? In-Reply-To: <20070621220547.GA21716@ayn.mi.celestial.com> Message-ID: On Thu, 21 Jun 2007, Bill Campbell wrote: > Train service from Seattle to Portland is reasonably reliable, but the > Portland to Seattle trains are commonly hours late. Their excuse is that > the Northbound trains start in California and ar subject to delays. I > would think that they would have figured out how to meet a schedule after a > hundred years or so. The problem isn't scheduling as much as that Amtrak has to yield right-of-track to freight trains, which often delays the trains. From schuh at farmdale.com Fri Jun 22 12:28:45 2007 From: schuh at farmdale.com (Mike Schuh) Date: Fri, 22 Jun 2007 12:28:45 -0700 (PDT) Subject: SPUG: railroad bandwidth (was: Ride to Oscon?) In-Reply-To: References: Message-ID: On Fri, 22 Jun 2007, John Costello wrote: >On Thu, 21 Jun 2007, Bill Campbell wrote: >> Train service from Seattle to Portland is reasonably reliable, but the >> Portland to Seattle trains are commonly hours late. > >The problem isn't scheduling as much as that Amtrak has to yield >right-of-track to freight trains, which often delays the trains. Amtrak trains along the I-5 corridor routinely pass waiting freight trains (I've experienced this many times between Portland and Seattle). Nonetheless, the passenger trains are often delayed and occasionally significantly late. The problem (to couch it in IT geek terms) is that the bandwidth of the rail lines south of Seattle has been oversubscribed. BNSF (who owns the tracks and has experienced significant growth in freight traffic), WSDOT (who actually owns track and rail cars elsewhere in the state), Sound Transit and AMTRAK are working on alleviating this. Ultimately, portions of the corridor will become four tracks - two for passenger service, two for freight. Passenger speed limits will be increased to at least 79 MPH for the entire corridor, and possibly to 110 MPH (Amtrak's Acela trains in the Northeast Corridor reach 150 MPH). If the latter limit could be maintained for the entire route, then we'd have two hour service to Portland... (WSDOT's goal for 2023 is 2 1/2 hours, an hour faster than today's travel time) http://www.wsdot.wa.gov/rail http://www.wsdot.wa.gov/projects/rail http://www.wsdot.wa.gov/NR/rdonlyres/E768E7BA-4788-42B1-ADC8-1BE01D1424E7/0/DraftLongRangePlanAmtrakCascades.pdf All of which is probably more than y'all wanted/needed to know... We now return you to our discussion of interpolated print strings, which is already in progress. Enjoy. -- Mike Schuh - Seattle, Washington USA http://www.farmdale.com From frank.carroll at wamu.net Sun Jun 24 00:19:58 2007 From: frank.carroll at wamu.net (Carroll, Frank) Date: Sun, 24 Jun 2007 00:19:58 -0700 Subject: SPUG: railroad bandwidth (was: Ride to Oscon?) In-Reply-To: References: Message-ID: <38417F406637E043AB37B94D6587806D0780C48A@exmsea002.us.wamu.net> There's a short but interesting article about presence of high-speed rail in just about every developed nation except for the U.S. in the latest edition of Wired. It mentions that the airline lobbyists are effectively fighting against the development of high-speed rail here in the states. Good luck finding a ride, Mr Kimball. I won't be attending the conference or I'd probably ride the train with you. -----Original Message----- From: spug-list-bounces+frank.carroll=wamu.net at pm.org [mailto:spug-list-bounces+frank.carroll=wamu.net at pm.org] On Behalf Of Mike Schuh Sent: Friday, June 22, 2007 12:29 PM To: 'Perl Users Group' Subject: Re: SPUG: railroad bandwidth (was: Ride to Oscon?) On Fri, 22 Jun 2007, John Costello wrote: >On Thu, 21 Jun 2007, Bill Campbell wrote: >> Train service from Seattle to Portland is reasonably reliable, but >> the Portland to Seattle trains are commonly hours late. > >The problem isn't scheduling as much as that Amtrak has to yield >right-of-track to freight trains, which often delays the trains. Amtrak trains along the I-5 corridor routinely pass waiting freight trains (I've experienced this many times between Portland and Seattle). Nonetheless, the passenger trains are often delayed and occasionally significantly late. The problem (to couch it in IT geek terms) is that the bandwidth of the rail lines south of Seattle has been oversubscribed. BNSF (who owns the tracks and has experienced significant growth in freight traffic), WSDOT (who actually owns track and rail cars elsewhere in the state), Sound Transit and AMTRAK are working on alleviating this. Ultimately, portions of the corridor will become four tracks - two for passenger service, two for freight. Passenger speed limits will be increased to at least 79 MPH for the entire corridor, and possibly to 110 MPH (Amtrak's Acela trains in the Northeast Corridor reach 150 MPH). If the latter limit could be maintained for the entire route, then we'd have two hour service to Portland... (WSDOT's goal for 2023 is 2 1/2 hours, an hour faster than today's travel time) http://www.wsdot.wa.gov/rail http://www.wsdot.wa.gov/projects/rail http://www.wsdot.wa.gov/NR/rdonlyres/E768E7BA-4788-42B1-ADC8-1BE01D1424E 7/0/DraftLongRangePlanAmtrakCascades.pdf All of which is probably more than y'all wanted/needed to know... We now return you to our discussion of interpolated print strings, which is already in progress. Enjoy. -- Mike Schuh - Seattle, Washington USA http://www.farmdale.com _____________________________________________________________ Seattle Perl Users Group Mailing List POST TO: spug-list at pm.org SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list MEETINGS: 3rd Tuesdays WEB PAGE: http://seattleperl.org/ From haircut at gmail.com Wed Jun 27 15:55:12 2007 From: haircut at gmail.com (Adam Monsen) Date: Wed, 27 Jun 2007 15:55:12 -0700 Subject: SPUG: OT: OSCON 2007: Wherefore not The Damian? I beseech thee! Message-ID: <9ebd65110706271555k65a2f5e7ia38cbde77fe571a2@mail.gmail.com> I've never besought in this manner before, but I really need your help! I was devastated to hear that my very favorite speaker, Damian Conway, will not make it to OSCON 2007 this year. I learned object orientation from Damian's book. I sat mouth agape (and might aghast) in his Lingua::Romana::Perligata talk many years ago. I've been inspired by his passion and creativity on many occasions. Apparently the new "Advanced VIM Scripting" tutorial speaker will be Steve Oualline. Does anyone know this person? If so, are they a good speaker? Is there any chance that Steve has torn apart Vim scripting as completely as I'm sure The Damian has? I'm just trying to figure out if I should ask for my money back. I paid out of pocket and it wasn't cheap! -- Adam Monsen From brianwisti at yahoo.com Wed Jun 27 16:38:03 2007 From: brianwisti at yahoo.com (Brian Wisti) Date: Wed, 27 Jun 2007 16:38:03 -0700 (PDT) Subject: SPUG: OT: OSCON 2007: Wherefore not The Damian? I beseech thee! In-Reply-To: <9ebd65110706271555k65a2f5e7ia38cbde77fe571a2@mail.gmail.com> Message-ID: <328574.62432.qm@web53603.mail.re2.yahoo.com> Hi Adam, --- Adam Monsen wrote: > I've never besought in this manner before, but I really need your > help! > > I was devastated to hear that my very favorite speaker, Damian > Conway, > will not make it to OSCON 2007 this year. I learned object > orientation > from Damian's book. I sat mouth agape (and might aghast) in his > Lingua::Romana::Perligata talk many years ago. I've been inspired by > his passion and creativity on many occasions. > > Apparently the new "Advanced VIM Scripting" tutorial speaker will be > Steve Oualline. Does anyone know this person? If so, are they a good > speaker? Is there any chance that Steve has torn apart Vim scripting > as completely as I'm sure The Damian has? > > I'm just trying to figure out if I should ask for my money back. I > paid out of pocket and it wasn't cheap! > > -- > Adam Monsen Steve Oualline has been around for a while. He wrote the "VI iMproved (VIM)" book, and is pretty knowledgeable on the topic. I find his style entertaining, others might not. Asking for your money back? Well, that's up to you. I'm sure there are one or two things you can do even without the presence of Damien Conway. Kind Regards, Brian Wisti http://coolnamehere.com/ ____________________________________________________________________________________ Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. http://tv.yahoo.com/collections/222 From damian at conway.org Wed Jun 27 17:49:26 2007 From: damian at conway.org (Damian Conway) Date: Thu, 28 Jun 2007 10:49:26 +1000 Subject: SPUG: OT: OSCON 2007: Wherefore not The Damian? I beseech thee! In-Reply-To: <9ebd65110706271555k65a2f5e7ia38cbde77fe571a2@mail.gmail.com> References: <9ebd65110706271555k65a2f5e7ia38cbde77fe571a2@mail.gmail.com> Message-ID: <46830596.5080303@conway.org> Adam Monsen wrote: > I was devastated to hear that my very favorite speaker, Damian Conway, > will not make it to OSCON 2007 this year. I'm truly sorry to hear that, Adam (though, of course, deeply gratified to be held in such esteem, especially by someone who can actually use the word "wherefore" correctly ;-) I was bitterly disappointed to have to cancel my summer speaking tour this year. In particular, I was distressed to be letting down those people like yourself who look forward to my presentations. > Apparently the new "Advanced VIM Scripting" tutorial speaker will be > Steve Oualline. Does anyone know this person? If so, are they a good > speaker? Is there any chance that Steve has torn apart Vim scripting > as completely as I'm sure The Damian has? I've never met Steve and I've never heard him speak or teach. Steve does know a great deal about Vim, having been involved right from the early days. But knowing and teaching aren't the same thing. I simply can't tell you how effectively he will be able to impart his undoubtedly expertise on others. The only even vaguely useful information might be the user reviews for his book on Vim: http://www.amazon.com/Vi-iMproved-VIM-Steve-Oualline/dp/0735710015 I *can* tell you that he is not working from my syllabus, and that the drafts of his syllabus that I have seen have had quite a different focus to mine: broader in scope (including some non-scripting related topics) but less detailed or intense. That's not necessarily a bad thing, but it does mean you definitely shouldn't expect it be a "Damian-style" class. > I'm just trying to figure out if I should ask for my money back. I > paid out of pocket and it wasn't cheap! I'm certain O'Reilly will happily refund your money, if you prefer not to take the class now that I'm not teaching it. If you decide on that course and experience any difficulties, please don't hesitate to contact me directly and I'll do my best to help sort it out. Damian From MichaelRWolf at att.net Fri Jun 29 08:37:11 2007 From: MichaelRWolf at att.net (Michael R. Wolf) Date: Fri, 29 Jun 2007 11:37:11 -0400 Subject: SPUG: OT: Hosting service recommendation Message-ID: <004301c7ba63$626fa100$3200000a@mlaptop> Off topic... But also to a well-informed, well-connected group that knows local hosting services... Can you recommend a hosting service with these services for setting up a collaborative sw environment for version control and bug tracking: - "vanity" domain hosting - standardized, simple-minded home page (without custom coding) - shell access (including Perl) - svn server (for collaborative sw version control with clients) - some kind of ticket or bug tracking plugin (also for clients) - not too much bandwith required - about $10-30/month I realize that the requirements are a blend of - summer job web site - professional software developer I was hoping that I could have expert tools without also having to do all the custom web development. Thanks, Michael -- Michael R. Wolf All mammals learn by playing! MichaelRWolf at att.net