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
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
Christophe Junke
alexandria
Commits
4907281d
Commit
4907281d
authored
14 years ago
by
Nikodemus Siivola
Browse files
Options
Downloads
Patches
Plain Diff
better docstring for MULTIPLE-VALUE-PROG2, a few more tests
parent
043f9804
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
control-flow.lisp
+5
-5
5 additions, 5 deletions
control-flow.lisp
package.lisp
+6
-3
6 additions, 3 deletions
package.lisp
tests.lisp
+25
-8
25 additions, 8 deletions
tests.lisp
with
36 additions
and
16 deletions
control-flow.lisp
+
5
−
5
View file @
4907281d
...
...
@@ -68,7 +68,7 @@ returns the values of DEFAULT if no keys match."
,
(
expand
possibilities
0
random-number
)))))))
(
defmacro
xor
(
&rest
datums
)
"Evaluates its argument one at a time, from left to right. If more then one
"Evaluates its argument
s
one at a time, from left to right. If more then one
argument evaluates to a true value no further DATUMS are evaluated, and NIL is
returned as both primary and secondary value. If exactly one argument
evaluates to true, its value is returned as the primary value after all the
...
...
@@ -100,7 +100,7 @@ NIL."
`
(
nth-value-or
,
nth-value
,@
(
rest
forms
))
nil
))))))
(
defmacro
multiple-value-prog2
(
first-form
second-form
&body
body
)
"
Like CL:MULTIPLE-VALUE-PROG1, except it saves the values of th
e
second form
."
`
(
progn
,
first-form
(
multiple-value-prog1
,
second-form
,@
body
)))
(
defmacro
multiple-value-prog2
(
first-form
second-form
&body
forms
)
"
Evaluates FIRST-FORM, then SECOND-FORM, and then FORMS. Yields as its valu
e
all the value returned by SECOND-FORM
."
`
(
progn
,
first-form
(
multiple-value-prog1
,
second-form
,@
forms
)))
This diff is collapsed.
Click to expand it.
package.lisp
+
6
−
3
View file @
4907281d
...
...
@@ -13,16 +13,19 @@
;; REVIEW IN PROGRESS
;;
;; Control flow
;;
;; -- no clear consensus yet --
#:cswitch
#:eswitch
#:switch
;; -- problem free? --
#:multiple-value-prog2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; REVIEW PENDING
;;
#:nth-value-or
#:whichever
#:xor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; REVIEW PENDING
;;
;; Definitions
#:define-constant
;; Hash tables
...
...
This diff is collapsed.
Click to expand it.
tests.lisp
+
25
−
8
View file @
4907281d
...
...
@@ -138,6 +138,21 @@
(
13.0
:oops
))
:yay
)
(
deftest
multiple-value-prog2.1
(
multiple-value-prog2
(
values
1
1
1
)
(
values
2
20
200
)
(
values
3
3
3
))
2
20
200
)
(
deftest
nth-value-or.1
(
multiple-value-bind
(
a
b
c
)
(
nth-value-or
1
(
values
1
nil
1
)
(
values
2
2
2
))
(
=
a
b
c
2
))
t
)
(
deftest
whichever.1
(
let
((
x
(
whichever
1
2
3
)))
(
and
(
member
x
'
(
1
2
3
))
t
))
...
...
@@ -156,6 +171,16 @@
1
t
)
(
deftest
xor.2
(
xor
nil
nil
1
2
)
nil
nil
)
(
deftest
xor.3
(
xor
nil
nil
nil
)
nil
t
)
;;;; Definitions
(
deftest
define-constant.1
...
...
@@ -1677,14 +1702,6 @@
:type-error
))
:type-error
)
(
deftest
nth-value-or.1
(
multiple-value-bind
(
a
b
c
)
(
nth-value-or
1
(
values
1
nil
1
)
(
values
2
2
2
))
(
=
a
b
c
2
))
t
)
(
deftest
doplist.1
(
let
(
keys
values
)
(
doplist
(
k
v
'
(
a
1
b
2
c
3
)
(
values
t
(
reverse
keys
)
(
reverse
values
)
k
v
))
...
...
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