Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
parenscript
parenscript
Commits
e120af64
Verified
Commit
e120af64
authored
Oct 26, 2018
by
Vladimir Sedach
Browse files
Simpler implementation of CHAIN
parent
ad82120d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/non-cl.lisp
View file @
e120af64
...
...
@@ -144,14 +144,16 @@
,@
(
cdr
props
))
obj
))
(
defun
chain
(
method-calls
)
(
let
((
chain
(
car
method-calls
)))
(
dolist
(
next
(
cdr
method-calls
))
(
setf
chain
(
if
(
consp
next
)
`
(
funcall
(
@
,
chain
,
(
car
next
))
,@
(
cdr
next
))
`
(
@
,
chain
,
next
))))
chain
))
(
defpsmacro
chain
(
&rest
method-calls
)
(
labels
((
do-chain
(
method-calls
)
(
if
(
cdr
method-calls
)
(
if
(
listp
(
car
method-calls
))
`
((
@
,
(
do-chain
(
cdr
method-calls
))
,
(
caar
method-calls
))
,@
(
cdar
method-calls
))
`
(
@
,
(
do-chain
(
cdr
method-calls
))
,
(
car
method-calls
)))
(
car
method-calls
))))
(
do-chain
(
reverse
method-calls
))))
(
chain
method-calls
))
;;; var
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment