projects
/
jscl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ac57d55
)
added afind primitive
author
Andrea Griffini
<agriff@tin.it>
Sun, 5 May 2013 20:40:30 +0000
(22:40 +0200)
committer
Andrea Griffini
<agriff@tin.it>
Sun, 5 May 2013 20:40:30 +0000
(22:40 +0200)
src/compiler.lisp
patch
|
blob
|
history
diff --git
a/src/compiler.lisp
b/src/compiler.lisp
index
8421b16
..
0f87ec3
100644
(file)
--- 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()")