clever-lang/clever — Issue #114: Array::find method
Author: pedrofaria
Created: 2012-02-15 17:31:03+00:00
State: open

Dears,

I really tried to build this method, but I still not having enough intelligence for it! LOL

The Idea is:

```
import std.io;

Array a;

a.push('Clever');
a.push('Programming');
a.push('Language');

println(a.find('Clever'));
println(a.find('Cleverasd'));

//Output: 0
//Output: -1
```

Where I stop:

```
CLEVER_METHOD(Array::find) {
ValueVector* vec = CLEVER_GET_ARRAY(CLEVER_THIS());

for (int64_t i = 0; i < vec->size(); i++) {
if (CLEVER_ARG(0) == vec->at(i)) {
CLEVER_RETURN_INT(i);
}
}

CLEVER_RETURN_INT(-1);
}
```

Every body told that I have to implement a Comparison etc etc etc... but I don't know how to start...

thanks