Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

The parable of the falling droplet

by robartes (Priest)
on Oct 20, 2002 at 23:31 UTC ( #206732=perlmeditation: print w/ replies, xml ) Need Help??

This is just a silly little thing that popped up from the mists of my mind. I'm not even sure it's in the right place, but here goes.

The parable of the falling droplet

Or: a silly little mnemonic for record separators

Cue our Hero: a confused Perl coder getting $/ and $\ mixed up again, despite the mnemonics mentioned in perlvar.

Cue The Solution: the Falling Droplet!

Imagine, if you will, a falling droplet of rain. It knows that its purpose in life is to fall down and follow the path of least resistance down to its final destination in a convenient body of water somewhere nearby. Imagine, now, that this droplet encounters an obstacle: a leaning toothpick. It will slide down this toothpick, happily rolling down the obstacle and continuing on its way:

o <--- our brave droplet . . <--- the path our droplet follows . / . / . / ./ <-- the leaning toothpick ./ ./ .../ -------- <-- the ground

Now, take a small mental sidestep and think of input and output: I/O. In between I and O is ... a leaning toothpick. Imagine our brave droplet falling down on this particular toothpick. If the toothpick is leaning towards the right, the droplet will end up on the left of it, if it is leaning to to the left, it will end up on the right of it. Or, if the toothpick leans to the right, the droplet will end up with the I, or input, and consequently, it will end up with the O, or output in the other case.

Cue (finally) The Point: Stick a $ in front of our leaning toothpick, imagine our droplet, and there's our mnemonic:

I/O $/ - droplet falls to left, or I - input record seperator $\ - droplet falls to right, or O - output record separator

Silly, but true.

CU
Robartes- who should really get some sleep now

Comment on The parable of the falling droplet
Select or Download Code
Re: The parable of the falling droplet
by grantm (Parson) on Oct 20, 2002 at 23:57 UTC
    Perhaps along similar lines, $| allows a droplet to take the quickest route down (out) without having to linger in a buffer.
Re: The parable of the falling droplet
by Aristotle (Chancellor) on Oct 21, 2002 at 00:10 UTC
    ++ for some great ASCII art work if nothing else ;-)

    Makeshifts last the longest.

      Agreed, but what has this to do with slashdot? - or am I missing the graphical point;-)

      Update: yes, pun intended and ++robartes for the great post!

      --
      Cheers, Joe

        More to the point (and consequently more OT), does this mean our beloved slashdot is a physical impossibility?? Observe...
        . <-- water droplet . / <-- toothpick ./ / /. <-- news for nerds ------
        Now how did that drop of rain get under that toothpick???
        -Bird
Re: The parable of the falling droplet
by jjdraco (Scribe) on Oct 21, 2002 at 00:53 UTC
    I'm impressed, that will definately help me with remembering which is which.

    jjdraco
    learning Perl one statement at a time.
Re: The parable of the falling droplet
by BrowserUk (Pope) on Oct 21, 2002 at 01:12 UTC

    Nice one, but... I'm not sure it passes the internationalisation test (yes, I know there's a short-form, but I can never remember the damn thing).

    If our brave raindrop was an Australian (or any other southern hemisphere) raindrop, does it still hold true. I seem to remember that their water flows the opposite way to ours...or is that only in annular orifices whence the annular orifice outflow retardation devices have been removed?

    I attempted, as is my usual practice, to benchmark this enlightening discovery, but in the absence of the wherewithal to adaquately model this, I attempted a little empirical evaluation.

    After much discussion and heated argument (me and myself couldn't agree, so I cast my deciding vote), a cocktail stick was adjudged to be an acceptable substitute for a toothpick. A piece of bluetac (an indispensible part of the Benchmark Monk's armoury) was retrieved from behind a lower corner of my i386 op-code, cpu-cycle chart and pressed (sic) into service.

    The third pre-requisite for the experiment was supplied (in abundance) by the oh-so-obliging, British weather.

    After careful statistical analysis of various fonts at a randomised selection of point-sizes, screen resolutions, and on a representative selection of physical hardware (ie. my screen), the appropriate angle of declination was determined to be 60°29'13".

    Unfortunately, despite the abundance of brave raindrops, various factors served to interfere with the outcome of the experiment.

    Even after numerous attempts to direct the brave raindrops to the required location, it was a frustratingly small sample of the above said abundance that obliged by landing in the requisite zone of evaluation.

    Even on those occasions when they could be pursuaded to commit their final acts as raindrops within said zone, they were observed to have an annoying alacrity for taking unauthorised shortcuts around the impeding oral debris removal device (substitute) in their hurry to join the massed ranks of nearby water bodies.**

    Also noted was that the testers occular resolution enhancement devices (see 'specs') proved to be an irresistable draw to a disproportionate number of the raindrops under test which rendered observational data unreliable.

    Further testing has been suspended until more conrolled test conditions can be devised and implemented.

    ** It was also observed to be impossible to distinguish which of the nearby water bodies now contained the aforesaid semi-obligant former-raindrops, so re-instruction and re-testing was impractical!


    Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!
      If our brave raindrop was an Australian (or any other southern hemisphere) raindrop, does it still hold true. I seem to remember that their water flows the opposite way to ours...

      if you're referring to the Coriolis effect -- and it sounds like you are -- the physicist in me feels the need to clear some things up.

      you often hear people claiming that bathtubs in the northern hemisphere drain clockwise while bathtups in the southern hemisphere drain counter-clockwise because of the Coriolis effect.

      the truth is that while the coriolis effect does exist and can have a significant impact on things like meteorology, its magnitude is far too small to have any practical effect over an area as small as a bathtub. the direction that the water spins as it drains is going to be dominated by the shape of the tub and any residual currents in the water. as a homework assignment for a physics class, i remember having to calculate the maximum residual current that the coriolis effect could overcome for a perfectly smooth, symetric, round bathtub. it was somewhere on the order of one rotation per year.

      but of course, everyone knows that the earth is really flat and on the back of a giant turtle, so the whole thing must just be a myth anyway. <grin />

      anders pearson

        Actually, I was referring to the fact that Aussie raindrops fall up:^) Relatively speaking.



        Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!
Silly parable
by perlmoth (Hermit) on Oct 21, 2002 at 08:46 UTC
    Yes it's silly, but that's what makes it so memorable. I always used to get these two mixed up and I always had to refer to perldoc perlvar, but now no more. Thanks.

    More silliness please.

Re: The parable of the falling droplet
by @rocks (Scribe) on Oct 22, 2002 at 05:13 UTC
    *Clapping* Great job robartes, I don't think I could have made a story that good even if I had a full nights sleep under my belt.

    Anyway, I would like to point out another mnemonic.... The Geometor's method of programm I/O in perl!

    It happens, that I am taking Geometry this year (8th grade) and your awesome drawing reminded me of something other than a toothpick or the I/O precedure.

    It remind me of....*DUM*DUM*DUM*! Angles! Yes, Angles, those pretty little things that make up a HUGE part of Geometry.

    these little, big, and medium (right) guys popped into my small head when I saw your drawing. As we all know a straight line that has a line coming out of it is a linear pair

    These linear pairs = 180 degrees. When you look at the I/O precedure, you see that if you were to place the ground (as shown in your original drawing) into the picture you would see the linear pair. The I/O example has a left angle that is obtuse that I would guess to be 115 degrees and the right is an acute angle of I would say about 65 degrees.

    In contrast, if you took the opposite, I\O you would also recieve the opposite in the angle's values. The left side would be 65 degree acute angle and the right, a 115 degree obtuse angle.

    This is my perspective of your concept Robartes. :-) I hope you find it interesting and worth the reading. I hope this may also help all those people who get / and \ confused. I wish you luck!

    -@rocks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://206732]
Approved by broquaint
Front-paged by jarich
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-07-12 06:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (238 votes), past polls