Arc Forumnew | comments | leaders | submitlogin
1 point by bOR_ 6039 days ago | link | parent

That points me in the right direction at least. I'd have wanted that everything in the list is just seen as a string, so "#\p" would indeed be smaller than "(bite #\p)" if the character "#" has a lower ascii code than "(".

coerce looked promising, but i'm not sure how to force a list like (bite #\p) into the string "(bite #\p)".

  (#\T #\p (bite #\p) (bite #\f) (bite #\P) (bite #\R) (bite #\S) (bite #\T) #\f #\B (bite #\B) #\P #\R #\S)
  (map [coerce _ 'string ] (keys craa!eltm))

  arc> (map [coerce _ 'string ] (list #\T #\p #\f))
  ("T" "p" "f")


1 point by absz 6039 days ago | link

The best way to do this is

  (sort (fn (a b)
          (< (tostring:write a)
             (tostring:write b)))
        (keys the-table))
; write will print the list, in that format, to stdout, and tostring captures stdout and puts it in a string, which it returns.

-----

1 point by bOR_ 6039 days ago | link

works like a charm. thanks!

-----