From 69f4ead4d3a5f853780816b07e4408abcbc21cfc Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Fri, 24 May 2013 02:06:24 +0100 Subject: [PATCH] Remove AFIND --- src/compiler.lisp | 6 +----- src/print.lisp | 10 +++++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/compiler.lisp b/src/compiler.lisp index 8bc6c63..ad61676 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -1579,11 +1579,7 @@ "if (i < 0 || i >= x.length) throw 'Out of range';" *newline* "return x[i] = " value ";" *newline*)) -(define-builtin afind (value array) - (js!selfcall - "var v = " value ";" *newline* - "var x = " array ";" *newline* - "return x.indexOf(v);" *newline*)) + (define-builtin get-internal-real-time () "(new Date()).getTime()") diff --git a/src/print.lisp b/src/print.lisp index 749faf8..ed7b8c1 100644 --- a/src/print.lisp +++ b/src/print.lisp @@ -114,16 +114,16 @@ ;; the id is changed to negative. If an object has an id < 0 then ;; #<-n># is printed instead of the object. ;; - ;; The processing is O(n^2) with n = number of tracked objects, - ;; but it should be reasonably fast because is based on afind that - ;; is a primitive function that compiles to [].indexOf. + ;; The processing is O(n^2) with n = number of tracked + ;; objects. Hopefully it will become good enough when the new + ;; compiler is available. (setf known-objects (make-array 100)) (setf object-ids (make-array 100)) (let ((n 0) (sz 100) (count 0)) (labels ((mark (x) - (let ((i (afind x known-objects))) + (let ((i (position x known-objects))) (if (= i -1) (progn (when (= n sz) @@ -157,7 +157,7 @@ (or (consp form) (vectorp form) (and form (symbolp form) (null (symbol-package form))))) - (let* ((ix (afind form known-objects)) + (let* ((ix (position form known-objects)) (id (aref object-ids ix))) (cond ((and id (> id 0)) -- 1.7.10.4