From 9ec1a0229b3a23e55350a914d393799d17ad9810 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Wed, 8 Oct 2014 13:41:43 +0200 Subject: [PATCH] [-let] Abstract the _ test into a function --- dash.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dash.el b/dash.el index 5abfe54..a6d1a3b 100644 --- a/dash.el +++ b/dash.el @@ -1174,6 +1174,11 @@ otherwise do ELSE." `(let ((it ,val)) (if it ,then ,@else))) +(defun dash--match-ignore-place-p (symbol) + "Return non-nil if SYMBOL is a symbol and starts with _." + (and (symbolp symbol) + (eq (aref (symbol-name symbol) 0) ?_))) + (defun dash--match-cons-skip-cdr (skip-cdr source) "Helper function generating idiomatic shifting code." (cond @@ -1248,8 +1253,7 @@ SOURCE is a proper or improper list." ((and (symbolp (car match-form)) (eq (car match-form) '&keys)) (dash--match-kv (cons '&plist (cdr match-form)) (dash--match-cons-get-cdr skip-cdr source))) - ((and (symbolp (car match-form)) - (eq (aref (symbol-name (car match-form)) 0) ?_)) + ((dash--match-ignore-place-p (car match-form)) (dash--match-cons-1 (cdr match-form) source (plist-put props :skip-cdr (1+ skip-cdr)))) (t