Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
alexandria
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
lovrolu
alexandria
Commits
048de2e5
Commit
048de2e5
authored
11 years ago
by
Attila Lendvai
Browse files
Options
Downloads
Patches
Plain Diff
Optimize DELETE-FROM-PLIST not to cons.
Patch by "James M. Lawrence" <llmjjmll@gmail.com>
parent
1bb1d834
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lists.lisp
+14
-2
14 additions, 2 deletions
lists.lisp
with
14 additions
and
2 deletions
lists.lisp
+
14
−
2
View file @
048de2e5
...
...
@@ -278,8 +278,20 @@ not destructively modified. Keys are compared using EQ."
(
defun
delete-from-plist
(
plist
&rest
keys
)
"Just like REMOVE-FROM-PLIST, but this version may destructively modify the
provided plist."
;; FIXME: should not cons
(
apply
'remove-from-plist
plist
keys
))
(
declare
(
optimize
speed
))
(
loop
with
head
=
plist
with
tail
=
nil
; a nil tail means an empty result so far
for
(
key
.
rest
)
on
plist
by
#'
cddr
do
(
assert
rest
()
"Expected a proper plist, got ~S"
plist
)
(
if
(
member
key
keys
:test
#'
eq
)
;; skip over this pair
(
symbol-macrolet
((
next
(
cdr
rest
)))
(
if
tail
(
setf
(
cdr
tail
)
next
)
(
setf
head
next
)))
;; keep this pair
(
setf
tail
rest
))
finally
(
return
head
)))
(
define-modify-macro
remove-from-plistf
(
&rest
keys
)
remove-from-plist
"Modify macro for REMOVE-FROM-PLIST."
)
...
...
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