Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from tali713/master

Added the restructuring abstraction
  • Loading branch information...
commit 80e98760b781924c76286a6a35fbf99929a0e905 2 parents e485201 + e8cbf5b
@nicferrier authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 kv.el
View
16 kv.el
@@ -219,6 +219,22 @@ FUNC is some sort of `assoc' like function."
(defalias 'dotassoc 'kvdotassoc)
(defalias 'dotassq 'kvdotassq)
+(defmacro kv-map-bind (args sexp seq)
+ "A hybrid of `destructuring-bind' and `mapcar'
+ARGS shall be of the form used with `destructuring-bind'
+
+Unlike most other mapping forms this is a macro intended to be
+used for structural transformations, so the expected usage will
+be that ARGS describes the structure of the items in SEQ, and
+SEXP will describe the structure desired."
+ (declare (indent 2))
+ (let ((entry (gensym)))
+ `(mapcar (lambda (,entry)
+ (destructuring-bind ,args ,entry ,sexp))
+ ,seq)))
+
+(defalias 'map-bind 'kv-map-bind)
+
(provide 'kv)
(provide 'dotassoc)
Please sign in to comment.
Something went wrong with that request. Please try again.