tungwaiyip.info

home

about me

links

my software

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

Blog

< November 2011 >
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
27282930   

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

A Program That Output Itself

Long time ago my schoolmate pose a challenge, write a program those output is itself. I take on the challenge think I'm fairly good in programming and mathematics. But I can never get it right and this problem haunted me for many years.

def rep(template):
    print template + 'rep(' + '"'*3 + template + '"'*3 + ")"

rep("""def rep(template):
    print template + 'rep(' + '"'*3 + template + '"'*3 + ")"

""")

Now that I'm reading Gödel, Escher, Bach I finally beginning to learn the technique. I am really happy to finally successfully written the program that output itself in Python above!

2011.11.17 [] - comments

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

S Korea leader condemns ferry crew (21 Apr 2014)

 

Ukraine probes deaths in tense east (21 Apr 2014)

 

Fresh violence erupts in Venezuela (21 Apr 2014)

 

PM's Christianity remarks 'divisive' (21 Apr 2014)

 

Gibraltar fire hits online gambling (21 Apr 2014)

 

Egypt's Sisi to face sole poll rival (20 Apr 2014)

 

Hostage reporters 'chained' in Syria (20 Apr 2014)

 

Iran's Rouhani urges women's rights (20 Apr 2014)

 

Finland air crash kills skydivers (20 Apr 2014)

 

Japan's trade deficit quadruples (21 Apr 2014)

more »

 

Slashdot News for nerds, stuff that matters

 

,000 Prosthetic Hand Outperformed By 3D Printed Hand (2014-04-21T00:18:00Z)

 

Biofuels From Corn Can Create More Greenhouse Gases Than Gasoline (2014-04-20T23:08:00Z)

 

L.A. Science Teacher Suspended Over Student Science Fair Projects (2014-04-20T22:11:00Z)

 

Why Portland Should Have Kept Its Water, Urine and All (2014-04-20T21:12:00Z)

 

SpaceX Successfully Delivers Supplies To ISS (2014-04-20T20:08:00Z)

 

Ask Slashdot: Professional Journaling/Notes Software? (2014-04-20T19:03:00Z)

 

Google Aids Scientology-Linked Group CCHR With Pay-Per-Click Ads (2014-04-20T17:59:00Z)

 

Cody Wilson Interview at Reason: Happiness Is a 3D Printed Gun (2014-04-20T16:45:00Z)

more »

 

TechPsychic Tech Rumors and Invented News

more »

 

SF Gate

 

Bay Area News (7 Jan 2012)

 

City Insider (11 Feb 2012)

 

Crime Scene (13 Feb 2012)

 

C.W Newius Column (10 Jan 2012)

 

C.W. Nevius Blog (11 Feb 2012)

 

Education News (10 Jan 2012)

 

KALW (11 Feb 2012)

 

Matier and Ross Blog (11 Feb 2012)

 

Chocolate prices skyrocket (19 Apr 2014)

 

Ship traffic for April 20 (19 Apr 2014)

 

Judge says American Airlines can't end retiree benefits yet (19 Apr 2014)

 

Tech companies produce original shows for Web TV (19 Apr 2014)

 

Once high-flying stocks lose momentum, it's hard to recover (19 Apr 2014)

 

Boston Marathon bombings make some rethink terror insurance (19 Apr 2014)

more »

 

Asia Times Online

 

Asia bucks military spending decline (15 Apr 2014)

 

Breaking bad in southern NATOstan (15 Apr 2014)

 

US veterans promote 'right to heal' (15 Apr 2014)

 

New China-India era no shoo-in under Modi (15 Apr 2014)

 

Doubts cloud China's urbanization drive (15 Apr 2014)

 

CREDIT BUBBLE BULLETIN Financial stability (15 Apr 2014)

more »

 


Site feed Updated: 2014-Apr-20 21:00