Skip to content

Commit

Permalink
Merge branch 'master' of github.com:VincentToups/shadchen-el
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentToups committed Apr 16, 2012
2 parents fe4be05 + cbac43e commit 0860c34
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions shadchen.el
Expand Up @@ -774,7 +774,7 @@ to use Emacs 24 & >'s lexical binding mode with regular match-let."
(defun extend-match-function (symbol function pattern &optional doc) (defun extend-match-function (symbol function pattern &optional doc)
"Extends the match function represented by symbol with the function FUNCTION." "Extends the match function represented by symbol with the function FUNCTION."
(let ((functions (gethash symbol *match-function-table*))) (let ((functions (gethash symbol *match-function-table*)))
(puthash symbol (reverse (cons function functions)) *match-function-table*) (puthash symbol (reverse (cons function (reverse functions))) *match-function-table*)
(if doc (if doc
(let ((current-doc (gethash symbol *match-function-doc-table* ""))) (let ((current-doc (gethash symbol *match-function-doc-table* "")))
(puthash symbol (puthash symbol
Expand All @@ -783,7 +783,7 @@ to use Emacs 24 & >'s lexical binding mode with regular match-let."
*match-function-doc-table*))) *match-function-doc-table*)))
symbol)) symbol))


(eval-when-compile (eval-when (compile load eval)
(defmacro* shadchen:let/named (name bindings &body body) (defmacro* shadchen:let/named (name bindings &body body)
(let ((arg-names (mapcar #'car bindings)) (let ((arg-names (mapcar #'car bindings))
(init-vals (mapcar #'cadr bindings)) (init-vals (mapcar #'cadr bindings))
Expand Down Expand Up @@ -965,6 +965,14 @@ pattern."
`(funcall (lambda (l) `(funcall (lambda (l)
(cons nil l)) (append-helper ,hd ,rest)))))) (cons nil l)) (append-helper ,hd ,rest))))))


(defmacro* match-lambda (&body body)
"Produce a lambda accepting a single argument and exectuting
the matching expression from the body."
(let ((arg (gensym "arg-")))
`(lambda (,arg)
(match ,arg
,@body))))

(provide 'shadchen) (provide 'shadchen)




Expand Down

0 comments on commit 0860c34

Please sign in to comment.