# Lisp and hash tables

**URL:** <https://racket.discourse.group/t/lisp-and-hash-tables/2295>\
**Category:** Questions & Answers\
**Created:** [September 7, 2023, 8:57am UTC](https://racket.discourse.group/t/lisp-and-hash-tables/2295 "2023-09-07T08:57:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteo-daddio](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/matteo-daddio/32/1245_2.png) [@matteo-daddio](https://racket.discourse.group/u/matteo-daddio)\
**Post date:** [September 7, 2023, 8:57am UTC](https://racket.discourse.group/t/lisp-and-hash-tables/2295/1 "2023-09-07T08:57:04Z")

</div>

Hello,  
I don't know if this has already been said by anyone else, but:

It’s well known that lisp is based on lists, but lists are based on pairs, so lisp is based on pairs, but pairs are actually vectors of length two, so lisp is based on vectors, but vectors are a very simple case of hash tables, so in the end lisp is based on hash tables.

What do you think?

Matteo

---

<div class="post-metadata">

**Author:** ![joskoot](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/joskoot/32/1964_2.png) [@joskoot](https://racket.discourse.group/u/joskoot)\
**Post date:** [September 7, 2023, 12:12pm UTC](https://racket.discourse.group/t/lisp-and-hash-tables/2295/2 "2023-09-07T12:12:05Z")

</div>

On what are hash tables based?

How about a cons-cell consisting of two pointers?

 ![49C29F22FA914E7CA5B25D35AE6EFB5F.png](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/2e839751fd263c2803de1577258c08f5c6235600.png)

---

<div class="post-metadata">

**Author:** ![scolobb](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/scolobb/32/108_2.png) [@scolobb](https://racket.discourse.group/u/scolobb)\
**Post date:** [September 7, 2023, 1:15pm UTC](https://racket.discourse.group/t/lisp-and-hash-tables/2295/3 "2023-09-07T13:15:30Z")

</div>

Hi @matteo-daddio ,

Where are you actually trying to get at with this reasoning?

Such chains can generally be made very long, and each connection is kind of arbitrary. For example, you ended in hash tables, but @joskoot went further to cons cells. You could also go to axiomatic set theory.

On the other hand, Lisp's syntax is very close to lambda calculus, which starts a wholly different chain.

Incidentally, this discussion makes me think about [The Glass Bead Game - Wikipedia](https://en.wikipedia.org/wiki/The_Glass_Bead_Game) :

> The game is essentially an abstract synthesis of all arts and sciences. It proceeds by players making deep connections between seemingly unrelated topics.

---

<div class="post-metadata">

**Author:** ![matteo-daddio](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/matteo-daddio/32/1245_2.png) [@matteo-daddio](https://racket.discourse.group/u/matteo-daddio)\
**Post date:** [September 8, 2023, 11:53am UTC](https://racket.discourse.group/t/lisp-and-hash-tables/2295/4 "2023-09-08T11:53:41Z")

</div>

> [@scolobb](#):
>
> Where are you actually trying to get at with this reasoning?

It’s only a joke 🙂

But thinking about it better, hash tables are trees and trees are lists of lists, so we are back to the beginning.

I think the basic idea are graphs. Every data structure can be seen as a graph, even programs, that are indeed data, are graphs.

In racket, with mutable pairs, is possible to create graphs, so is possible to create _every_ data structure.

Matteo

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [September 8, 2023, 2:38pm UTC](https://racket.discourse.group/t/lisp-and-hash-tables/2295/5 "2023-09-08T14:38:26Z")

</div>

You could say that everything is a mutable vector, because that's what computer memory is.

Well... maybe what it was, decades ago, on a small personal computer.

Today that linear address space is an illusion backed by a whole hierarchy of cache levels, pages mapped to various RAM chips, swap files on "disk", etc.

So I suppose everything is a hash-table of hash-tables, after all. 😄

---

<div class="post-metadata">

**Author:** ![matteo-daddio](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/matteo-daddio/32/1245_2.png) [@matteo-daddio](https://racket.discourse.group/u/matteo-daddio)\
**Post date:** [September 9, 2023, 12:03pm UTC](https://racket.discourse.group/t/lisp-and-hash-tables/2295/6 "2023-09-09T12:03:41Z")

</div>

There are two point of view: make complex data structure with simple data structure and consider small data structure as a simple case of complex data structure.

For example hash tables are made of pairs and pairs can be seen as very simple hash tables.

Also complex numbers: real numbers are complex numbers with zero imaginary part and complex numbers can be seen as a couple of real numbers.
