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
bfecc4e1
Commit
bfecc4e1
authored
34 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Added Dan's NTH-VALUE macro.
parent
092f222e
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
code/macros.lisp
+20
-2
20 additions, 2 deletions
code/macros.lisp
with
20 additions
and
2 deletions
code/macros.lisp
+
20
−
2
View file @
bfecc4e1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/macros.lisp,v 1.1
7
199
0/12/11 12:45:13 wlott
Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/macros.lisp,v 1.1
8
199
1/01/30 15:50:26 ram
Exp $
;;;
;;;
;;; This file contains the macros that are part of the standard
;;; This file contains the macros that are part of the standard
;;; Spice Lisp environment.
;;; Spice Lisp environment.
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
with-open-stream
with-input-from-string
with-output-to-string
with-open-stream
with-input-from-string
with-output-to-string
locally
etypecase
ctypecase
ecase
ccase
locally
etypecase
ctypecase
ecase
ccase
get-setf-method
get-setf-method-multiple-value
get-setf-method
get-setf-method-multiple-value
define-modify-macro
destructuring-bind
define-modify-macro
destructuring-bind
nth-value
otherwise
))
; Sacred to CASE and related macros.
otherwise
))
; Sacred to CASE and related macros.
(
in-package
"EXTENSIONS"
)
(
in-package
"EXTENSIONS"
)
...
@@ -413,6 +413,24 @@
...
@@ -413,6 +413,24 @@
(
defmacro
multiple-value-list
(
value-form
)
(
defmacro
multiple-value-list
(
value-form
)
`
(
multiple-value-call
#'
list
,
value-form
))
`
(
multiple-value-call
#'
list
,
value-form
))
(
defmacro
nth-value
(
n
form
)
"Evaluates FORM and returns the Nth value (zero based). This involves no
consing when N is a trivial constant integer."
(
if
(
integerp
n
)
(
let
((
dummy-list
nil
)
(
wendy
(
gensym
)))
;; We build DUMMY-LIST, a list of variables to bind to useless
;; values, then we explicitly IGNORE those bindings and return
;; WENDY, the only thing we're really interested in right now.
(
dotimes
(
i
n
)
(
push
(
gensym
)
dummy-list
))
`
(
multiple-value-bind
(
,@
dummy-list
,
wendy
)
,
form
(
declare
(
ingore
,@
dummy-list
))
,
wendy
))
`
(
nth
,
n
(
multiple-value-list
,
form
))))
;;;; SETF and friends.
;;;; SETF and friends.
...
...
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