Arc Forumnew | comments | leaders | submitlogin
4 points by almkglor 5899 days ago | link | parent

This "array" support is really for an abstract sparse array (with a hashtable implementation). I think what's being referred to is a "real array" (with a sequential-cells-of-memory implementation.)


1 point by Jekyll 5898 days ago | link

That's a shame. I was all excited for a minute.

I guess I'll have start poking about in the source this weekend and see how hard it is to push the functionality up from the underlying scheme.

-----

1 point by almkglor 5898 days ago | link

While you're at it, try to see if it can be pushed up in lib/array.arc on the arc-wiki.

-----

1 point by sacado 5898 days ago | link

Oh, sorry. I guess it has to be added then :)

-----

3 points by sacado 5898 days ago | link

Do you think it is the right thing ? If so, I'll push it to the git. Nothing amazing there, just mzscheme vectors that can be called as hash tables, lists or string. It's got a constructor (vec) and responds to len. Any further function can (should) be written in Arc.

  arc> (= v (vec 10))
  #10(nil)
  arc> (= (v 1) 0)
  0
  arc> (len v)
  10
  arc> (v 0)
  nil
  arc> (v 1)
  0
  arc> (v 10)
  Error: "vector-ref: index 10 out of range [0, 9] for vector: #10(nil 0 nil)"

-----

2 points by almkglor 5898 days ago | link

Looks good. I vote for "push".

Edit: Although it might (?) be better in the lib/array.arc, unless of course it's already integrated into ac.scm...

Edit2: Also, I hope (vec ...) is a function, not a macro or special form, so that existing code that uses vec as a local variable for a collection, or as a function, can still work.

-----

2 points by sacado 5898 days ago | link

It can't be put in a .arc file, since it is pure scheme code. Further functions dealing with vectors should go in lib/array.arc, however. And yes, vec is a function.

-----

2 points by Jekyll 5898 days ago | link

That's awesome, but I've just lost all my motivation to learn git.

Nice work :D.

-----

1 point by sacado 5897 days ago | link

It is still very basic. Many utilitary functions could be added on top of that if you want :)

-----

1 point by sacado 5898 days ago | link

pushed. type on a vector also returns 'vec.

-----