Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fare-utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
François-René Rideau
fare-utils
Commits
09f4a697
Commit
09f4a697
authored
15 years ago
by
Francois-Rene Rideau
Browse files
Options
Downloads
Patches
Plain Diff
Fix drop for <im> (?)
parent
af780821
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pure/tree.lisp
+18
-2
18 additions, 2 deletions
pure/tree.lisp
test/functional-map.lisp
+0
-1
0 additions, 1 deletion
test/functional-map.lisp
with
18 additions
and
3 deletions
pure/tree.lisp
+
18
−
2
View file @
09f4a697
...
...
@@ -133,11 +133,13 @@ between them, re-balancing as needed."))
(
node
i
:key
kk
:value
vv
:left
(
left
node
)
:right
(
drop
i
(
right
node
)
kk
)))))
v
t
))
(
-1
(
multiple-value-bind
(
left
value
foundp
)
(
drop
i
(
left
node
)
key
)
(
-1
(
multiple-value-bind
(
left
value
foundp
)
(
drop
i
(
left
node
)
key
)
(
values
(
node
i
:key
k
:value
v
:left
left
:right
(
right
node
))
value
foundp
)))
(
1
(
multiple-value-bind
(
right
value
foundp
)
(
drop
i
(
right
node
)
key
)
(
1
(
multiple-value-bind
(
right
value
foundp
)
(
drop
i
(
right
node
)
key
)
(
values
(
node
i
:key
k
:value
v
:left
(
left
node
)
:right
right
)
value
foundp
)))))))
...
...
@@ -297,8 +299,22 @@ node is always called with branches that are of comparable height...
:key
(
node-key
right
)
:value
(
node-value
right
)
:right
(
right
right
))))))))
#| For debugging only
(defmethod print-object ((x binary-tree-node) stream)
(format stream "#<avl ~A>"
(flatten-binary-tree x)))
(defun flatten-binary-tree (x)
(etypecase x
(null '())
(binary-tree-node
(remove-if #'null
(list (flatten-binary-tree (left x))
(node-key x) (flatten-binary-tree (right x)))))))
|#
;;; Common special case: when keys are numbers
;;; TODO: rename to number-map ???
(
defclass
<integer-map>
(
<avl-tree>
order:<numeric>
)
())
(
defparameter
<integer-map>
(
memo:memoized
'make-instance
'<integer-map>
))
...
...
This diff is collapsed.
Click to expand it.
test/functional-map.lisp
+
0
−
1
View file @
09f4a697
...
...
@@ -133,4 +133,3 @@
(
deftest
test-pure-map-interfaces
()
(
dolist
(
i
(
list
<alist>
<im>
<hash-table>
<fmim>
))
(
interface-test
i
)))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment