From: Andrea Griffini Date: Sun, 5 May 2013 20:40:30 +0000 (+0200) Subject: added afind primitive X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=3e62ce31499c237e604b4301af7b4d83cab410be;p=jscl.git added afind primitive --- diff --git a/src/compiler.lisp b/src/compiler.lisp index 8421b16..0f87ec3 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -1598,6 +1598,12 @@ "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()")