Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Carl Shapiro
cmucl
Commits
3e7aa042
Commit
3e7aa042
authored
34 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Added COMPLEMENT and CONSTANTLY functions from FUNCTION-COMPOSITION cleanup.
parent
bfecc4e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/list.lisp
+35
-2
35 additions, 2 deletions
code/list.lisp
with
35 additions
and
2 deletions
code/list.lisp
+
35
−
2
View file @
3e7aa042
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
nset-difference
set-exclusive-or
nset-exclusive-or
subsetp
nset-difference
set-exclusive-or
nset-exclusive-or
subsetp
acons
pairlis
acons
pairlis
assoc
assoc-if
assoc-if-not
assoc
assoc-if
assoc-if-not
rassoc
rassoc-if
rassoc-if-not
))
rassoc
rassoc-if
rassoc-if-not
complement
constantly
))
(
proclaim
'
(
maybe-inline
(
proclaim
'
(
maybe-inline
tree-equal
list-length
nth
%setnth
nthcdr
last
make-list
append
tree-equal
list-length
nth
%setnth
nthcdr
last
make-list
append
...
@@ -776,6 +776,39 @@
...
@@ -776,6 +776,39 @@
thing
)
thing
)
(
defun
complement
(
function
)
"Builds a new function that returns T whenever FUNCTION returns NIL and
NIL whenever FUNCTION returns T."
#'
(
lambda
(
&optional
(
arg0
nil
arg0-p
)
(
arg1
nil
arg1-p
)
(
arg2
nil
arg2-p
)
&rest
more-args
)
(
not
(
cond
(
more-args
(
apply
function
arg0
arg1
arg2
more-args
))
(
arg2-p
(
funcall
function
arg0
arg1
arg2
))
(
arg1-p
(
funcall
function
arg0
arg1
))
(
arg0-p
(
funcall
function
arg0
))
(
t
(
funcall
function
))))))
(
defun
constantly
(
value
&optional
(
val1
nil
val1-p
)
(
val2
nil
val2-p
)
&rest
more-values
)
"Builds a function that always returns VALUE, and posisbly MORE-VALUES."
(
cond
(
more-values
(
let
((
list
(
list*
value
val1
val2
more-values
)))
#'
(
lambda
()
(
declare
(
optimize
(
speed
3
)
(
safety
0
)))
(
values-list
list
))))
(
val2-p
#'
(
lambda
()
(
declare
(
optimize
(
speed
3
)
(
safety
0
)))
(
values
value
val1
val2
)))
(
val1-p
#'
(
lambda
()
(
declare
(
optimize
(
speed
3
)
(
safety
0
)))
(
values
value
val1
)))
(
t
#'
(
lambda
()
(
declare
(
optimize
(
speed
3
)
(
safety
0
)))
value
))))
;;; Functions that operate on association lists
;;; Functions that operate on association lists
...
...
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