Skip to content

Commit

Permalink
trees++ simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
vindarel committed Oct 28, 2024
1 parent d709d92 commit 2703365
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions data-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -813,12 +813,6 @@ You can also use `pushnew`, that modifies the list (see above).
;; => T
~~~

## Fset - immutable data structure

You may want to have a look at the
[FSet](https://common-lisp.net/project/fset/Site/FSet-Tutorial.html )
library (in Quicklisp).


## Arrays and vectors

Expand Down Expand Up @@ -1981,11 +1975,30 @@ doesn't have such limitations. See the [CLOS section](clos.html).
* [structures on the hyperspec](http://www.lispworks.com/documentation/HyperSpec/Body/08_.htm)
* David B. Lamkins, ["Successful Lisp, How to Understand and Use Common Lisp"](http://www.communitypicks.com/r/lisp/s/17592186045679-successful-lisp-how-to-understand-and-use-common).

## Tree
## Trees

### Built-ins

A tree can be built with lists of lists.

For example, the nested list `'(A (B) (C (D) (E)))` represents the tree:

```
A
├─ B
╰─ C
├─ D
╰─ E
```

`tree-equal`, `copy-tree`. They descend recursively into the car and
where `(B)`, `(D)` and `(E)` are leaf nodes.

The functions `tree-equal` and `copy-tree` descend recursively into the car and
the cdr of the cons cells they visit.

See the functions `subst` and `sublis` above to replace elements in a tree.


### Sycamore - purely functional weight-balanced binary trees

[https://github.com/ndantam/sycamore](https://github.com/ndantam/sycamore)
Expand All @@ -1999,6 +2012,15 @@ Features:
* Purely functional [pairing heaps](http://en.wikipedia.org/wiki/Pairing_heap)
* Purely functional amortized queue.

See also FSet.

## Fset - immutable data structures

You may want to have a look at the
[FSet](https://common-lisp.net/project/fset/Site/FSet-Tutorial.html )
library (in Quicklisp) to use immutable data structures.


## Controlling how much of data to print (`*print-length*`, `*print-level*`)

Use `*print-length*` and `*print-level*`.
Expand Down

0 comments on commit 2703365

Please sign in to comment.