Created
April 12, 2011 05:48
-
-
Save shelling/915016 to your computer and use it in GitHub Desktop.
foreach in elisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env emacs --script | |
(require 'cl) | |
(defun foreach (alist func) | |
(while alist | |
(progn | |
(funcall func (car alist)) | |
(setq alist (cdr alist))) | |
)) | |
(setq foo '("hello" "world")) | |
(foreach foo | |
(lambda (x) (message x))) | |
(foreach '(1 2 3) | |
(lambda (x) (message "%d" (+ 10 x)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment