Whispers over coffee: a LISP conversation in a coffee shop

SOFTWARE DEVELOPMENT | 23-05-2024
Whispers over coffee: a LISP conversation in a coffee shop
Whispers over coffee: a LISP conversation in a coffee shop
It's a warm spring afternoon in Lisbon. João, weary from hours of video conferences at SISCOG, needs a break and heads to a nearby coffee shop. Inside, he unexpectedly overhears an intriguing discussion between colleagues, Zé and Maria, about a programming language. Zé passionately praises its elegance and power, while Maria remains skeptical. Their debate reveals the language’s hidden beauty and potential.
Whispers over coffee: a LISP conversation in a coffee shop

 

João Pavão Martins, CEO,  @SISCOG  |  12 min read 

___________

 

It was one of those warm Spring afternoons.

Despite being at SISCOG’s Lisbon office, I had spent the last two hours in a video conference. My office was quite hot because the building management hadn't turned on the "chiller" yet. I was tired and thirsty. I glanced at the options on my desk: two bottles of water, probably warm. After an intense afternoon, which included two hours of continuous meetings, I thought I deserved something better at the end of the day and decided to go for a beer at "Manos, ("which means “brothers”) as we affectionately call the coffee shop adjacent to SISCOG. I informed Lídia I'd be back shortly and got into the elevator, which, this time, smoothly took me to the ground floor.

At Campo Grande, it was one of those beautiful afternoons with a deep blue sky that is only seen in Portugal. The traffic leaving the city was starting to build up.

I entered the coffee shop and noticed two persons from SISCOG, Zé and Maria, sitting at a table engaged in a lively discussion. They didn't even see me. Zé, with thick-framed glasses and a neatly trimmed beard, an enthusiast of the technology used at SISCOG, gestured enthusiastically as he spoke. On the other side, Maria, newly hired for the Products Department, with short hair and a calm expression, listened attentively, occasionally nodding in agreement.

I approached the counter and asked Fábio for a draft beer. While waiting, I heard Maria mention the word LISP, which caught my attention. I then discreetly focused on following their conversation.

Zé argued, “But how can you say that LISP syntax is strange and confusing, that it seems more like a random sequence of parentheses than organized code, which frustrates modern programmers? LISP syntax is beautiful! It is based on a single concept, S-expressions, allowing programmers to write concise and readable code that is easy to understand and modify. Its prefix notation corresponds to a uniform way of representing function applications. I agree that LISP syntax may seem intimidating at first, but once you get used to it, the clarity and expressiveness of the code are unparalleled. Its learning curve may also be somewhat challenging, especially for you, who loves C++, but the rewards in terms of productivity and flexibility make the effort to learn the language worthwhile.”

“My learning curve is really discouraging me.”

“Don't be discouraged, Maria. The steep learning curve is precisely what separates amateurs from true masters. Those who dedicate themselves to mastering LISP are rewarded with a deeper understanding of programming fundamentals and an ability to solve problems in ways they never imagined possible.”

“But I never know what type a variable is, and it bothers me not knowing what operations I can perform with it,” Maria timidly responds.

“Maria, listen to me carefully, that's another advantage of LISP over your beloved C++. In C++, when you define a variable, you're forced to commit to its type. In LISP, variables are not typed, allowing values to be polymorphic and enabling rapid prototyping without the need for explicit type indications. Dynamic binding means that function definitions can evolve independently of their invocations, promoting a highly adaptable and iterative development process.”

“My friends tell me that LISP is a programming dinosaur, a relic of the past.”

Zé roars with laughter at this comment, and I take the opportunity to order a “pastel de nata” (custard tart).

“In that line of reasoning”, argues Zé, “we could also say that Michelangelo's Pietà is a dinosaur of sculpture, advocating that the pile of stones atop Parque Eduardo VII in Lisbon, which some consider a masterpiece by artist and author João Cutileiro, represents true sculpture, Maria, don't mess with me... LISP is a masterpiece of software engineering, created by a mathematician and one of the greatest scientists of the 20th century, John McCarthy.”

 

John McCarthy (1927-2011). American computer scientist and cognitive scientist. Coined the term "artificial intelligence"

John McCarthy (1927-2011). American computer scientist and cognitive scientist. Coined the term "artificial intelligence". Additional information below.

 

And Zé continues, recounting the characteristics of LISP, much to my delight.

“LISP is an elegant and expressive language that allows programmers to create innovative solutions with unprecedented ease. Code and data in LISP are essentially the same, enabling programs to be easily manipulated and transformed using functions. Its highly flexible and its uniform syntax features the characteristic of homoiconicity, a concept introduced by John McCarthy in the early 1960s, meaning that the program's code is represented in the same way as its main data structure, the list. This property allows LISP programs to manipulate and transform their own code as data, enabling self-inspection and meta-programming. Since programs can inspect, modify, and generate new code during execution, LISP allows the language itself to be extended and customized by the programmer. Homoiconicity also simplifies tasks such as code generation and manipulation, making it easier to build tools for tasks such as refactoring, code analysis, and automated testing. Most programming languages that you label as modern, like Java, Python, and your beloved C++, are not homoiconic; their code is represented by a structure different from the data they manipulate.”

“Wow! That's new to me. Are you saying that in LISP, I can write a program that writes programs? How is that possible?”

“Like I mentioned, in LISP, code and data share the same structure, the list. You can write a program that produces a list that syntactically has the structure of a function and tell LISP to evaluate that list, which automatically generates a new function within your environment. You can also treat an existing function as data, inspecting that function and modifying it if you wish.”

“That does sound fantastic, Zé, but even if LISP has its niches, its lack of general popularity makes it impractical for most programmers. Learning and maintaining knowledge about LISP is a time- and effort-investment that most programmers aren't willing to make.”

“If you're looking for an easy and popular language, LISP might not be the best choice. But if you value expressiveness, flexibility, and the power of metaprogramming, LISP offers a unique and rewarding programming experience. It is a language for those who appreciate the beauty and elegance of software engineering. Moreover, C++ can also be complex and difficult to master, especially for beginners. Its extensive set of features, including concepts like pointers, manual memory management, and multiple inheritance, can lead to code that is very hard to understand, debug, and maintain.”

“So why isn't LISP widely used?”

“Paraphrasing Prof. Stuart Shapiro, "they don’t understand...". In reality, a large portion of the programming community has never been able to rise above embedded parenthesis syntax and prefix notation, preferring conventional declarative languages and never reached the level of abstraction that LISP provides. The LISP community is confined to groups of enthusiasts who can see the true potential of the language. Even the Julia language, being developed at MIT, attempting to capture many of LISP's strengths with a more conventional syntax, has stumbled upon homoiconicity, which it fails to achieve.”

“But the LISP development community is smaller than that of other languages, which means there might be fewer libraries and resources available to solve specific problems.”

“It's true that the LISP community may be smaller than that of other languages, but it's active and passionate.,” Zé responds, “However, there are many resources available, such as extensive documentation, libraries, and online forums, to assist programmers. Furthermore, the expressive and meta-programmable nature of LISP allows these programmers to create their own libraries and custom tools.”

 

Cover of the book "Structure and Interpretation of Computer Programs," written by Harold Abelson, Gerald Jay Sussman, and Julie Sussman, initially published by the MIT Press in 1985 and subject to several reeditions.

Cover of the book "Structure and Interpretation of Computer Programs," written by Harold Abelson, Gerald Jay Sussman, and Julie Sussman, initially published by the MIT Press in 1985 and subject to several reeditions. Details about this image below.

 

“Are there many programs developed in LISP?”

“Well, SISCOG Suite is a notable example, allowing SISCOG to offer products fully tailored to clients' needs, unlike our competitors who require clients to adapt to their products. Moreover, numerous institutions continue to use LISP. Its presence is strong in specialized areas such as AI, natural language processing, and robotics. Institutions such as NASA, Google, Autodesk, Cycorp, and Diffbot successfully use LISP to solve complex problems in their domains. And even in other sectors, such as finance and engineering, LISP remains a preferred choice for those who require performance and reliability. For example, Emacs, which you are beginning to learn, is written in a dialect of LISP, giving it the flexibility you will soon come to appreciate.”

“Zé, you just mentioned performance, and the impression I have is that LISP's performance is significantly inferior to that of other languages like C and C++.”

“You are touching upon what has become an urban myth. It is true that LISP's performance was a concern in the past, but with technological advancements and optimizations in modern implementations, that gap has disappeared, and metaprogramming can be used to further optimize code for specific tasks. I recall a tale from several years back featuring a programmer at SISCOG, I believe he was named Filipe, that much like yourself, he championed C++, citing its performance as the primary argument against LISP. The management gave him the freedom and the challenge to implement a part of CREWS in C++ and compare the performance of his implementation with that of LISP. After a few months, Filipe was completely frustrated; no matter how hard he tried, the performance of his C++ application couldn't beat LISP's.”

“But what about the availability of resources and support across different platforms? That could still be a barrier for many projects.”

“That's a valid concern, especially in specific development niches. However, LISP has a dedicated community that continues to create libraries and tools for a variety of applications. Additionally, in fields like artificial intelligence and symbolic processing, LISP remains the preferred choice due to its unique capabilities. It may be true that LISP isn't for everyone, but for those willing to dive into LISP, the rewards are unparalleled. As more people recognize the unique value of LISP and its metaprogramming capabilities, I'm confident we'll see a resurgence of interest and greater adoption in the industry. For now, let's agree to disagree, but don't be surprised if LISP ends up exceeding all your expectations in the future.”

“Well, Zé, the conversation has been quite extensive and enjoyable, but I must be on my way.”

 

As they settled their bills, Zé and Maria noticed my presence and greeted me in a friendly way. As they left, I no longer felt tired, continuing to savor my beer, feeling immensely proud of the quality of people we have at SISCOG.

 

LISP Advantages

 

 

______________________

Additional Information

 

John McCarthy

John McCarthy (1927-2011) was one of the pioneers of artificial intelligence (AI), leaving a lasting legacy in the field of computing. His career was marked by groundbreaking innovations and fundamental contributions that shaped modern AI. Among his most notable achievements, McCarthy coined the term "Artificial Intelligence" in 1956, outlining a new area of research aimed at creating machines capable of performing tasks that, if done by humans, would be considered intelligent.

McCarthy was the creator of LISP, one of the most influential and enduring programming languages, specially designed to facilitate the development of AI. His visionary approach enabled significant advances in symbolic manipulation and the development of logical reasoning systems.

In addition to his technical contributions, McCarthy played a key role in the establishment of the AI laboratory at Stanford University, which became a center of excellence and innovation. He was also a tireless advocate for AI research, promoting collaborations among scientists and fostering debate on the ethical and social implications of AI.

John McCarthy's career is a testament to his genius and dedication. His ideas and inventions not only ushered in a new era in computer science but also inspired generations of researchers to explore the boundaries of what machines can accomplish. His vision continues to influence and guide the development of AI, consolidating his place as a central figure in the history of technology.

 

Image of the cover of the book "Structure and Interpretation of Computer Programs"

The image corresponds to the cover of the book "Structure and Interpretation of Computer Programs," written by Harold Abelson, Gerald Jay Sussman, and Julie Sussman, initially published by the MIT Press in 1985 and subject to several reeditions. Sometimes known as the "Wizard book," it is considered one of the best books ever published on programming. To convey the concepts, it uses the Scheme language, a LISP dialect.

The image is both iconic and symbolic within the programming community.

It depicts a wizard with a pointed hat and cloak, casting a spell with a crystal ball, in which the mystical words of LISP, "Eval" and "Apply," appear. The assistant symbolizes the programmer.

In the book, programming is seen as a kind of magic (a program is the "wizard" inside the machine) through which the programmer exercises the power to create complex and powerful systems through the application of knowledge and skills.

The lambda (the representation of a function in LISP) and the light symbolize the magical transformation that occurs when the programmer applies its knowledge to create programs. This transformation is similar to magic, where abstract ideas are converted into tangible and functional systems.

The act of the wizard casting a spell signifies the programming process - writing code that instructs the computer to perform specific tasks, emphasizing the creative and intellectual effort involved in programming.

The book aims to teach readers to think like computer scientists, cultivating the ability to abstract and solve problems in an elegant and powerful way. This is the main idea underlying the image, that programming is a profoundly intellectual and creative process.