summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2024-03-23 21:00:08 +0100
committerJonas Bernoulli <jonas@bernoul.li>2024-03-23 21:00:08 +0100
commit3d11815594487e142dd51019a59d050b32dcc063 (patch)
tree780803f901e2c347cb26810dd4f2fb78b1693d34
parent2a353789261767c0f5cdfc9408384e96ea10912a (diff)
##: Order steps chronologically
-rw-r--r--llama.el44
1 files changed, 22 insertions, 22 deletions
diff --git a/llama.el b/llama.el
index f312089..a213b57 100644
--- a/llama.el
+++ b/llama.el
@@ -109,30 +109,30 @@ It also looks a bit like #\\='function."
(body (llama--collect body args))
(rest (aref args 0))
(args (nreverse (cdr (append args nil))))
+ (args (let (symbols)
+ (dolist (symbol args)
+ (when (or symbol symbols)
+ (push symbol symbols)))
+ symbols))
(pos 0)
- (opt nil))
+ (opt nil)
+ (args (mapcar
+ (lambda (symbol)
+ (setq pos (1+ pos))
+ (cond
+ ((not symbol)
+ (list (intern (format "_%c%s" (if opt ?& ?%) pos))))
+ ((string-match-p "\\`_?%" (symbol-name symbol))
+ (when opt
+ (error "`%s' cannot follow optional arguments" symbol))
+ (list symbol))
+ (opt
+ (list symbol))
+ ((setq opt t)
+ (list '&optional symbol))))
+ args)))
`(lambda
- (,@(apply
- #'nconc
- (mapcar
- (lambda (symbol)
- (setq pos (1+ pos))
- (cond
- ((not symbol)
- (list (intern (format "_%c%s" (if opt ?& ?%) pos))))
- ((string-match-p "\\`_?%" (symbol-name symbol))
- (when opt
- (error "`%s' cannot follow optional arguments" symbol))
- (list symbol))
- (opt
- (list symbol))
- ((setq opt t)
- (list '&optional symbol))))
- (let (symbols)
- (dolist (symbol args)
- (when (or symbol symbols)
- (push symbol symbols)))
- symbols)))
+ (,@(apply #'nconc args)
,@(and rest (list '&rest rest)))
(,fn ,@body))))