Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/Ptrees.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The underlying issue is that futures have no knowledge of the computation tree i
Ptrees may be built dynamically as follows.

```lisp
(let ((tree (make-ptree)))
(let ((tree (make-ptree :test #'eq)))
(ptree-fn 'area '(width height) (lambda (w h) (* w h)) tree)
(ptree-fn 'width '(border) (lambda (b) (+ 7 (* 2 b))) tree)
(ptree-fn 'height '(border) (lambda (b) (+ 5 (* 2 b))) tree)
Expand All @@ -61,7 +61,7 @@ Ptrees may be built dynamically as follows.
; => 63
```

This code resembles the expansion of the ptree macro example above. Note that a node identifier need not be a symbol; any object suitable for eql comparison will do.
This code resembles the expansion of the ptree macro example above. Note that a node identifier need not be a symbol; any object suitable for `eq`/`eql`/`equal`/`equalp` (default is `eql`) comparison will do.

clear-ptree restores the tree to its original uncomputed state. clear-ptree-errors restores to the last pre-error state.

Expand Down
7 changes: 5 additions & 2 deletions src/ptree.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,12 @@
"A ptree is a computation represented by a tree together with
functionality to execute the tree in parallel."))

(defun make-ptree ()
(defun make-ptree ( &key (test #'eql) )
"Create a ptree instance."
(make-ptree-instance))
(let ((p (make-ptree-instance)))
(with-ptree-slots (nodes) p
(setf nodes (make-hash-table :test test)))
p))

(defun/type compute-ptree (root ptree kernel) (node ptree kernel) node
(declare #.*normal-optimize*)
Expand Down
Loading