Skip to content

Commit

Permalink
add apply-partially defun
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Aug 19, 2011
1 parent 0b06b86 commit 266849c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions coffee-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ to the error, of course."
(defvar coffee-mode-map (make-keymap)
"Keymap for CoffeeScript major mode.")

;;
;; Compat
;;

(unless (fboundp 'apply-partially)
(defun apply-partially (fun &rest args)
"Return a function that is a partial application of FUN to ARGS.
ARGS is a list of the first N arguments to pass to FUN.
The result is a new function which does the same as FUN, except that
the first N arguments are fixed at the values with which this function
was called."
(lexical-let ((fun fun) (args1 args))
(lambda (&rest args2) (apply fun (append args1 args2))))))

;;
;; Macros
;;
Expand Down

0 comments on commit 266849c

Please sign in to comment.