A ladder to the sky

Since the introduction to python included thinking about how arithmetic operations work I was immediatly reminded of the author of my favorite book Lewis Caroll who had a special like on creating math and word games. 

Upon looking for word games I could apply for my assigment I ran into Caroll's word ladders and since I was following the class notes to guide me in the assigment I realized I could make my text look like an actual ladder.

All this ladder thinking  made my mind land on "La Bamba" which is not an origianl song by Richie Valens, or the name of your neighborhood´s hard-shell "taco" joint. "La Bamba" is a traditional "Son Jarocho" a mexican music genre from Veracruz.

(Here are over a jaroch@s breaking a world record while dancing said song)

But I'm getting off track here. 

The reason I landed in La Bamba was because part of its lyrics go: "Para llegar al cielo se necesita, se necesita una escalera larga, una escalera larga ay arriba y arriba" ("To get to the sky a long ladder is needed, a long ladder and up an up"). And since I was planning of going up there I thought that the first person I would visit in the sky it would be my grandfather.

So I decided to develop a program that would build said impossible ladder through Carrolls technique of transforming one word into another, and since land has one too many letters and is way too overated as a place to dwell, I decided to start my climb up from the sea.

Because this ladder would be ultimately connecting my grandfather and me. I picked one of his favorite authors and one of her best poems: Emily Dickinson´s "The brain is wider than the sky" and one of my favorite poets and an adequate (and incredibly beautiful) poem of his: Pablo Neruda´s "The Sea"  

So I used four very basic programs written in python:

lineCopy.py - which prints all the lines that have less than 10 characters

diezletras.py - which prints the first ten letters of a sentence (perfect for form giving to the text)

swap.py - I did various iterations of this one in order to build Caroll's ladder process of exchanging the letters in sea and sky .

And two main .txt files for each of the poems. I tried to write a complex python program to try my talets but it turns out my talents are not quite up there yet. So I designed a process that went like this:

1. $ python swap.py < sky.txt > skydos.txt :

for line in sys.stdin:
    line = line.strip()
    print line.replace ('k', 'e')

2. $ python swapdos.py<skydos.txt>skytres.txt:

for line in sys.stdin:
    line = line.strip()
    print line.replace ('y', 'a')

3. $ python swapthree.py < sea.txt > seados.txt :

for line in sys.stdin:
    line = line.strip()
    print line.replace ('e', 'k')

4. $ python swapcuatro.py < seados.txt> seatres.txt:

for line in sys.stdin:
    line = line.strip()
    print line.replace ('a', 'y')

5. $ python linecopy.py < skytres.txt > skycuatro.txt:

for line in sys.stdin:
  line = line.strip()
  if len(line) >= 10:
      print line

6. $ python linecopy.py <seatres.txt > seacuatro.txt

7. I tried to use a .py cat imitator but it didn´t work to print both archives together. So just for this process I used unix´s cat

$ python cat.py< skycuatro.txt seacuatro.txt > escalera.txt:

for line in sys.stdin:
  line = line.strip()
  print line

$ cat skycuatro.txt seacuatro.txt>escalera.txt

8. $ python armar.py < escalera.txt > escaleraalcielo.txt

for line in sys.stdin:
    line = line.strip()
    first_five = line[:5]
    last_five = line[-5:]
    print first_five + last_five

escaleraalcielo.txt==

the be sea
for - side
the ontain
with eside
the be sea
for   blue
the obsorb
as spts do
the bf god
for  pound
and tea do
as sasound
i nkks mk,
i donnkss,
if  iknck,
or onining
suggkhips.
thk flkkp,
in sovk in
thk uyvks.
it?s nchkd
ys iflynkt
wkrk kyth;
no, imknt,
thk ssylt,
ynd tnful.
whyt synd.
it sk myn,
to hyfirk;
nkvkrbyss,
thk ccold,
thk gstyr,
thk s wyvk
squynfoym,
thk q surk
ys y pths,
rkplyowing
stubbvion,
ynd mntly:
ys i mknt.