| Was trying to get the keys of a table of mine sorted, and searched google for a way to do it. This webpage quoted a bit from the arc tutorial that I had almost forgotten (about using alists rather than tables when you want sorting), and disputes that you can't sort tables. http://rondam.blogspot.com/2008/01/my-take-on-arc.html
First, hash tables can be sorted, at least in the sense
that associated lists can be sorted. Just get a list of
the keys and sort them. Or create a sorted-hash-table that
maintains an adjunct sorted list of keys. This is not
rocket science. But that is not the problem.
Should I just switch to using alists?, I tried sorting (keys tablename) see below, but that gave an error. arc> (keys craa!eltm)
(#\T #\p (bite #\p) (bite #\f) (bite #\P) (bite #\R) (bite #\S) (bite #\T) #\f #\B (bite #\B) #\P #\R #\S)
arc> (sort < (keys craa!eltm))
Error: "<: expects type <real number> as 2nd argument, given: #\\p; other arguments were: (bite #\\p)"
(I'm now in the phase of pretty-printing the first results. Should have a blog entry up soon enough to show you what I'm using arc for, and I'm posting a bit more then I'd normally do on the forum to get rid of the ghost-town feeling mentioned earlier by someone else ;)) |