equal
deleted
inserted
replaced
75 (when (boundp 'user-home-page) (concat ", " user-home-page)))) |
75 (when (boundp 'user-home-page) (concat ", " user-home-page)))) |
76 |
76 |
77 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
77 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
78 (message "my defun, defmacro, defvar") |
78 (message "my defun, defmacro, defvar") |
79 |
79 |
80 (defmacro my-filter (condfunc list) |
80 (defmacro my-filter (pred list) |
81 "Construct list with elements from LIST which satisfy CONDFUNC." |
81 "Construct list with elements from LIST which satisfy PRED." |
82 `(let (r) |
82 `(let ( (r '(nil)) ) |
83 (mapc (lambda (item) |
83 (mapc (lambda (item) |
84 (when (,condfunc item) |
84 (when (,pred item) |
85 (if r |
85 (nconc r (cons item nil)))) |
86 (nconc r (cons item nil)) |
|
87 (setq r (cons item nil))))) |
|
88 ,list) |
86 ,list) |
89 r)) |
87 (cdr r))) |
90 |
88 |
91 (defun my-fold (f x list) |
89 (defun my-fold (f x list) |
92 "Recursively applies (F i j) to LIST starting with X. |
90 "Recursively applies (F i j) to LIST starting with X. |
93 For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)." |
91 For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)." |
94 (let ((li list) (x2 x)) |
92 (let ((li list) (x2 x)) |