diff --git a/dash.el b/dash.el index 92fadbc..7e7db7e 100644 --- a/dash.el +++ b/dash.el @@ -1453,8 +1453,7 @@ See `-let' for the description of destructuring mechanism." ((not (consp match-form)) (error "match-form must be a list")) ;; no destructuring, so just return regular lambda to make things faster - ((and (consp match-form) - (symbolp (car match-form))) + ((-all? 'symbolp match-form) `(lambda ,match-form ,@body)) (t (let* ((inputs (--map-indexed (list it (make-symbol (format "input%d" it-index))) match-form))) diff --git a/dev/examples.el b/dev/examples.el index 55f3572..aa171f4 100644 --- a/dev/examples.el +++ b/dev/examples.el @@ -766,7 +766,9 @@ new list." (-map (-lambda ((&plist :a a :b b)) (+ a b)) '((:a 1 :b 2) (:a 3 :b 4) (:a 5 :b 6))) => '(3 7 11) (-map (-lambda (x) (let ((k (car x)) (v (cadr x))) (+ k v))) '((1 2) (3 4) (5 6))) => '(3 7 11) (funcall (-lambda ((a) (b)) (+ a b)) '(1 2 3) '(4 5 6)) => 5 - (condition-case nil (progn (-lambda a t) (error "previous form should error")) (error t)) => t)) + (condition-case nil (progn (-lambda a t) (error "previous form should error")) (error t)) => t + (funcall (-lambda (a b) (+ a b)) 1 2) => 3 + (funcall (-lambda (a (b c)) (+ a b c)) 1 (list 2 3)) => 6)) (def-example-group "Side-effects" "Functions iterating over lists for side-effect only."