DELAPARRA
Index
Color
NL
Category: Programming paradigms

Homoiconicity

Explained by Updated

What is Homoiconicity?

Homoiconicity: A language property where code is written in the language's own basic data structure — making code trivially inspectable and generable as data. Homoiconicity means a language's code is written in the same data structures the language uses for data. In Lisp and Clojure, code is made of lists, so a program can read, inspect, build and transform other code as easily as any other list.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Homoiconicity

How is Homoiconicity used in practice?

This makes macros very powerful. A macro is a function that receives code as data and returns new code, which lets developers add new syntax and constructs to the language itself.

What should you keep in mind with Homoiconicity?

Most mainstream languages are not homoiconic, but the idea shows up in other forms. Tools work with abstract syntax trees to analyse and rewrite code, as PHPStan, Rector and ESLint do. Configuration as data, such as JSON or YAML that a program interprets, borrows the same insight in a simpler way.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with H

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.