Amazing Lisp/Scheme

I never really understood all the power of Lisp/Scheme syntax associated with the quote facility to represent and use data in a human readable way.

We often talk about homoiconicity as the first quality of Lisp/Scheme.
That it is the program representation being the same as the data representation. But it is relatively rare to have to manipulate the code in the code,unless we create for example syntax extensions or other things.
Data manipulation is more often used,for declaration, assignment. Think of C or C++ and other language where it is hard to represent data in code... with enumeration perhaps.
Even in Java when you want to insert data in code, you have to write code, not just insert your data, as in this example with ArrayList:

Python is more easy with that.
For example, even if this example has no concrete use, in Python the parser allow you to describe data in code just as they are represented, that is in a direct human readable way, not using code:

Python 3.12.3 (main, Nov  6 2025, 13:44:16) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> [1,"hello",[4,("good","bye"),6]] # a Python List containing String,List,Tuples,Numbers
[1, 'hello', [4, ('good', 'bye'), 6]]

I think Python is a very used language because it is very easy to describe data in code in an easy way just with their representation.

In Lisp/Scheme i recently discovered, or rediscovered to be honest, but i did not really understood the power of this, that we can use complex nested structure representation that are quoted to use them directly in code as it is possible in Python.

Here is an example that use almost the same representation than Python, with the difference that in Python , List can be indexed , so i will use vectors in Scheme/Lisp,also i will use List in Scheme/Lisp as they look the same as Tuple in Python for representation, note also i do not take in account the Mutability/immutability of objects that could be different between Scheme/Racket/Python/Lisp (and even vectors in Scheme exist in 2 different versions mutable and immutable) because i have not this in mind when writting now, this is out of topic but can be discussed.It is obvious that Python and Lisp/Scheme have near but different data types.

The above Python example could be made in Lisp/Scheme like that:

#lang racket

#(1 "hello" #(4 ("good" "bye") 6)) ; a Scheme vector containing String,Vectors, Lists,Numbers

Welcome to DrRacket, version 8.18.0.13-2025-08-26-0bb5c26e85 [cs].
Language: racket, with debugging; memory limit: 8192 MB.

#(1 "hello" #(4 ("good" "bye") 6))

Then in Python it is quite easy to use this data, here is an example:

>>> [1,"hello",[4,("good","bye"),6]][2][1]
('good', 'bye')

And the same syntax facility can also be reach in Scheme:

#lang reader SRFI-105
(require Scheme+)

{#(1 "hello" #(4 ("good" "bye") 6))[2][1]}

Welcome to DrRacket, version 8.18.0.13-2025-08-26-0bb5c26e85 [cs].
Language: reader SRFI-105, with debugging; memory limit: 8192 MB.

'("good" "bye")

Note that i stated about quote in the beginning but vectors notation in Scheme with #( ...) are implicitely already quoted and all subexpression are then quoted too.

2 Likes