Our life around REPL – Read–Eval–Print Loop

Whenever I see my niece so comfortable with iPhone, Mac, Advance Toys; I usually wonder almost similar feeling our parents must have pondered about us. But what is the biggest disadvantage of being part of GEN X. What? We have best things in the world but the irony is that we don’t enjoy or embrace the inventions/creations done by our forefathers generation. For us TV, Radio, Telephone, Mobile, Desktop was little obvious, now for next generation iPhone, iPad, Smartphone, DSLR, Laptops, Tablets et al are very obvious. Its clearly visible our parents struggle with our generation widgets and I have now started to struggle with next-generation gadgets.

You must be thinking what is it had to do with REPL. During college days, I started coding in C, bit of Java (to clear job interviews incase required), then majorly on PHP, RUBY, PYTHON, JAVASCRIPT, BASH. The moment I started coding on these languages, which are derived from their forefathers C & Lisp, I sensed a sheer bliss while working on them and started promoting them in peer group as soon as I realized the language is always available and it was obvious not to look back at C, C++, Java and many others. We can easily compare it to Gramophone, cassettes, VCR , VCP, Landline but these inventions were the foundation of where we stand today in our life or in programming world.

I was not clear about the term REPL when I started working on these languages and thought of it as a jargon of programming world. Recently, wrote a smallest code on ruby and a REPL was created. This is when I realized the power of REPL and thought to read about their forefathers. Let’s first have a sneak-peek into that smallest piece of ruby repl code.REPL

#!/usr/bin/env ruby
loop {p eval gets }

 

Now read this piece of code in reverse order, READ (gets), EVAL, PRINT (p), LOOP. Save this file as repl.rb and run as`ruby repl.rb`

─$ ruby repl.rb 1 ↵
"akshay Gupta".upcase
"AKSHAY GUPTA"
1+2*3
7

Congratulations, now you understand REPL and underlying fact of  language is always available i.e. no real distinction between read-time, compile-time and run-time. Now, when I start working on any new language, it’s easier to pick up if it’s REPL based and I truly thank Mr. John McCarthy father of Artificial Intelligence, creator of LISP (where lies the roots of REPL) for his immense contribution in the field of computer science, AI, programming languages and so many programming paradigm. If i’m not wrong, he is also the inventor of if-then-else conditional construct and we take these for granted now.

Running code at read-time lets users reprogram; running code at compile-time is the basis of macros; compiling at runtime is the basis of Lisp’s use as an extension language in programs like Emacs; and reading at runtime enables programs to communicate using expressions.

There have been two really clean, consistent models of programming so far: the C model and the Lisp model. As computers have grown more powerful, the new languages being developed have been moving steadily toward the Lisp model. A popular recipe for new programming languages in the past 20 years has been to take the C model of computing and add some parts taken from the Lisp model, like runtime typing and garbage collection.

repl-loop

It’s equally important to look forward and innovate in coming time and respect, embrace the efforts of our remarkable forefathers. To read and practice different languages that support REPL please follow the below links. I primarily depend heavily upon irb and PRY.

In our everyday life we do nothing more than READ (consume knowledge), EVAL ( between right and wrong), PRINT (discuss around), LOOP (day everyday) i.e. REPL 🙂

 

Moments, Life and Remarkability

Moments pass by as a drop of water, each one of it make Life. Moments vanishes as you start thinking of it to complete your life. But just analyze WHY? Why are we here ? What we are supposed to be?
Some good saying: Live whole-heartedly, help others, do whatever you like with passion, contribute to the miraculous deeds our ancestors had done once, never give up life will always test your patience and endurance. Is it love, lust, success we are living for? Are we going the right way? Are we destined ?

If one ever think of why Einstein, Faraday, Sachin, Gandhi..name anyone..why were they great?How come respect comes out of its own while remembering them.

  • Simple they discovered something, they were leaders, they were simply different.
  • How come they were different, they were mere humans.

Your answers started sprouting:

  • Things were easier at that time. Nah
  • Easy resources. Not possible.
  • Plenty of time to try out something new. Not sure? same 24 hours.
  • Things was unexplored, now everything is there. Same thoughts prevails over centuries.
Eight Secrets Of Life

View SlideShare presentation or Upload your own. (tags: secrets powerpoint)
It seems they did something different, impossible and remarkable. My thoughts say follow those simple guys who were remarkable, contributer and made their life worth living. Moving against the tide is never easy, but the flew, they were not different rather they were much simpler. Isn’t?
Its just that they analyzed and walked through the path their heart was leading. It was their passion and inner urge to follow their dream that made them remarkable. They never did it to be famous or for wealth, its the satisfaction they were thriving for. This is greatness.Now, lets discuss our life, we are brought up educated, equipped with all resources (most of them one don’t even need), plenty of time (exclude the time spent on cell, chat, bc and complains about life), I belief everything is more easy, approachable, just one click away thanks to Mr Tim Berners Lee. One dont have to travel years to find where India is, on boat with few crew members. Our great remarkable leaders fulfilled all the resposibilities, they did loved some one, they did married, they did whatever a common man spent time upon. So whats missing ??

Passion, Depth of thought, Direction etc
In one thought we have never thought, why are we here for? It was their remarability that made them respectable, different, famous, successful. You know Apple never fell over Newton‘s head, he was just sitting idle under apple tree and looking at calm moon and an Apple and he realized that both are of same size and yet one falls down and one never. So distance can make things look alike but something decreases and he coined the name as Gravity. Remarkable enough for the whole world.In Modern World one try to dress, talk , walk, become rich but surprisingly none of them takes to the path of remarkability other than creating differences, boundaries. Simplicity is the characterstic of being different.

I believe “Simplicity of character is the natural result of profound thought