mes: Move pair? to core.

* src/lib.c (pair_p): New function.  Gains 8% performance on MesCC.
This commit is contained in:
Jan Nieuwenhuizen 2018-10-18 20:06:10 +02:00
parent f660d149a5
commit 5a8024ca82
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
9 changed files with 8 additions and 15 deletions

View File

@ -42,7 +42,6 @@
;; end boot-00.scm
;; boot-01.scm
(define (pair? x) (eq? (core:type x) <cell:pair>))
(define (not x) (if x #f #t))
(define (display x . rest)

View File

@ -32,7 +32,6 @@
;; end boot-00.scm
;; boot-01.scm
(define (pair? x) (eq? (core:type x) <cell:pair>))
(define (not x) (if x #f #t))
(define (display x . rest)

View File

@ -42,7 +42,6 @@
;; end boot-00.scm
;; boot-01.scm
(define (pair? x) (eq? (core:type x) <cell:pair>))
(define (not x) (if x #f #t))
(define (display x . rest)

View File

@ -75,9 +75,6 @@
(define (number? x)
(eq? (core:type x) <cell:number>))
(define (pair? x)
(eq? (core:type x) <cell:pair>))
(define (port? x)
(eq? (core:type x) <cell:port>))

View File

@ -16,9 +16,6 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
(define (pair? x)
(eq? (core:type x) <cell:pair>))
(define (atom? x)
(if (pair? x) #f
(if (null? x) #f

View File

@ -16,8 +16,6 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
(define (pair? x) (eq? (core:type x) <cell:pair>))
(define (not x) (if x #f #t))
(define-macro (or . x)

View File

@ -16,7 +16,6 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
(define (pair? x) (eq? (core:type x) <cell:pair>))
(define (vector? x)
(eq? (core:type x) <cell:vector>))
@ -85,7 +84,7 @@
;; ((lambda (a d)
;; (core:display " a=") (core:display a) (core:display "\n")
;; (core:display " d=") (core:display d)
;; (if (pair? d)
;; (if (eq? (car d) 'quote)
;; (if (and (pair? a) (eq? (car a) 'quote))
@ -133,7 +132,7 @@
(core:display "\n")
(core:display "CDR d=") (core:display d)
(core:display "\n")
(if (pair? d)
(if (eq? (car d) 'quote)
(if (and (pair? a) (eq? (car a) 'quote))

View File

@ -36,7 +36,6 @@
(define <cell:pair> 7)
(define <cell:string> 10)
(define (pair? x) (eq? (core:type x) <cell:pair>))
(define (not x) (if x #f #t))
(define (display x . rest)

View File

@ -348,3 +348,9 @@ last_pair (SCM x)
x = CDR (x);
return x;
}
SCM
pair_p (SCM x)
{
return TYPE (x) == TPAIR ? cell_t : cell_f;
}