Changeset 6090
- Timestamp:
- 02/03/08 08:33:55 (5 years ago)
- Files:
-
- 1 modified
-
lang/c/misc/mlisp/lib.l (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/misc/mlisp/lib.l
r5974 r6090 23 23 (defun caar (x) (car (car x))) 24 24 (defun cdar (x) (cdr (car x))) 25 (defun cadr (x) (car (cdr x))) 25 26 26 27 (defun > (x y) (< y x)) … … 46 47 (t (+ 1 (length (cdr ls)))))) 47 48 49 ;;; mapcar �̒l����Ȃ���= each 50 (defun mapc (fn ls) 51 (cond (ls 52 (fn (car ls)) 53 (mapc fn (cdr ls))))) 54 55 ;;; mapcar 48 56 (defun mapcar (fn ls) 49 57 (cond ((eq ls nil) nil) … … 51 59 (mapcar fn (cdr ls)))))) 52 60 53 54 61 (defun zerop (x) (eq x 0)) 55 62 (defun evenp (x) (eq (% x 2) 0)) 56 63 (defun oddp (x) (eq (% x 2) 1)) 57 64 58 (def un inc (x) (+ x 1))59 (defun dec (x) (- x 1))65 (defmacro incf (x n) 66 `(setq ,x (+ ,x n))) 60 67 68 (defmacro decf (x n) 69 `(setq ,x (- ,x n))) 61 70 62 71 ; �Q�̃��X�g�������(defun concat (x y) … … 87 96 (cond (else (list (list t else))))))) 88 97 98 99 100 101 ; �R�s�[ 102 (setq eql eq) 103 104 (defun member (obj lst) 105 (if (null lst) 106 nil 107 (if (eql (car lst) obj) 108 lst 109 (member obj (cdr lst))))) 110 111 (defun nthcdr (n lst) 112 (if (zerop n) 113 lst 114 (nthcdr (- n 1) (cdr lst)))) 115 116 (defun nth (n lst) 117 (car (nthcdr n lst))) 118 119 ;;; let 120 ;;; On Lisp fig 11.1 (p148) 121 (defmacro let (binds . body) 122 `((lambda ,(mapcar (lambda (x) 123 (if (consp x) (car x) x)) 124 binds) 125 ,@body) 126 ,@(mapcar (lambda (x) 127 (if (consp x) (cadr x) nil)) 128 binds)))
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)