Arc Forumnew | comments | leaders | submitlogin
2 points by kens 6147 days ago | link | parent

It looks like "on" is broken for tables. I'd expect "on" to get the values, like "each", rather than nil.

  arc> (each x (obj k1 'v1 k2 'v2) (prn x))
  v1
  v2

  arc> (on x (obj k1 'v1 k2 'v2) (prn index " " x))
  0 nil
  1 nil


1 point by Jesin 6117 days ago | link

I think that's because on works like this:

  (for index 0 (- len.foo 1) ...)
Because the hash table you used didn't have any entries for 0 or 1, it gave nil.

  arc> (= a (table))
  #hash()
  arc> a!foo
  nil
  arc> (= a!foo 'bar)
  bar
  arc> a!foo
  bar
  arc> a.0
  nil

-----