Compiler macros optimize first, second,...

This commit is contained in:
Juan Jose Garcia Ripoll 2011-12-03 23:34:09 +01:00
parent f26a13885e
commit 7a2678acb2
2 changed files with 9 additions and 11 deletions

View file

@ -120,6 +120,15 @@
(t whole))
whole))
;;;
;;; FIRST, SECOND, THIRD, ...
;;;
(progn .
#.(loop for n in '(first second third fourth fifth sixth seventh eighth ninth tenth)
for i from 0
collect `(define-compiler-macro ,n (x) (list 'nth ,i x))))
;;;
;;; POP
;;;

View file

@ -360,17 +360,6 @@
(def-inline nth :unsafe (t t) t "ecl_nth(fix(#0),#1)")
(def-inline nth :unsafe (fixnum t) t "ecl_nth(#0,#1)")
(def-inline first :always (t) t "ecl_car(#0)")
(def-inline second :always (t) t "ecl_cadr(#0)")
(def-inline third :always (t) t "ecl_caddr(#0)")
(def-inline fourth :always (t) t "ecl_cadddr(#0)")
(def-inline first :unsafe (cons) t "ECL_CONS_CAR(#0)")
(def-inline first :unsafe (t) t "_ecl_car(#0)")
(def-inline second :unsafe (t) t "_ecl_cadr(#0)")
(def-inline third :unsafe (t) t "_ecl_caddr(#0)")
(def-inline fourth :unsafe (t) t "_ecl_cadddr(#0)")
(def-inline rest :always (t) t "ecl_cdr(#0)")
(def-inline rest :unsafe (cons) t "ECL_CONS_CDR(#0)")
(def-inline rest :unsafe (t) t "_ecl_cdr(#0)")