emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: turn-on-*-mode


From: Johan Bockgård
Subject: Re: turn-on-*-mode
Date: Wed, 17 May 2006 03:26:20 +0200
User-agent: Gnus/5.110005 (No Gnus v0.5) Emacs/22.0.50 (gnu/linux)

"Stuart D. Herring" <address@hidden> writes:

> Or (somewhat tongue-in-cheek) have
> (defun curry (func &rest args)
>   `(lambda (&rest args2) (apply ',func (append ',args args2))))
>
> So that one can write
> (add-hook 'text-mode-hook (curry 'auto-fill-mode 1))

The lexbind branch has this.

,----
| curry is a built-in function in `src/eval.c'.
| (curry fun &rest args)
| 
| Return fun curried with args.
| The result is a function-like object that will append any arguments it
| is called with to args, and call fun with the resulting list of
| arguments.
| 
| For instance:
|   (funcall (curry '+ 3 4 5) 2) is the same as (funcall '+ 3 4 5 2)
| and:
|   (mapcar (curry 'concat "The ") '("a" "b" "c"))
|   => ("The a" "The b" "The c")
`----

-- 
Johan Bockgård





reply via email to

[Prev in Thread] Current Thread [Next in Thread]