Arc Forumnew | comments | leaders | submitlogin
1 point by thaddeus 5408 days ago | link | parent

I think the difficult part is passing in an arbitrary name to a function, for which the tables 'name' becomes set to, but I am just guessing that's what he wants...

and I agree I don't see a whole lot of need for the function to be part of the arc release..., since there are probably better ways to accomplish the same end result.... a good example of which is news.arc's storage of story records.



1 point by fallintothis 5408 days ago | link

I think the difficult part is passing in an arbitrary name to a function, for which the tables 'name' becomes set to, but I am just guessing that's what he wants...

I rather doubt that's the issue, as it's easy to do with a macro.

  arc> (mac filltbl (tbl keys vals)
         `(= ,tbl (fill-table (table) (mappend list ,keys ,vals))))
  #3(tagged mac #<procedure: filltbl>)
  arc> (filltbl blah '(a b c) '(1 2 3))
  #hash((c . 3) (a . 1) (b . 2))
  arc> blah
  #hash((c . 3) (a . 1) (b . 2))

I think it's just a request for a convenience function to zip together a list of keys with a list of values into a table, since the existing methods for creating tables center around having alternating key/value pairs.

-----

1 point by thaddeus 5408 days ago | link

Agreed, it was only a wild guess given he was already given a good solution, yet...

   "Am I missing anything here?"
So I don't know what the deal is, but I don't plan to spend any time thinking about it :)

-----