Arc Forumnew | comments | leaders | submitlogin
New in arc3 :) "string" is applied recursively
15 points by aw 5278 days ago | 1 comment
Yes, arc3 has been out for five months now :-) but look at what I just noticed...

(coerce x 'string) is now applied recursively when x is a list, so in arc3

  arc> (coerce '(a b (c d (e f) g)) 'string)
  "abcdefg"
string is defined in terms of coerce, so string now works recursively as well:

  arc> (string 'a '(b (c d (e f) g)) 'h 'i)
  "abcdefghi"
The means that in many places where (apply string ...) had needed to be used, such as in reassemble-args in srv.arc:

  (def reassemble-args (req)
    (aif req!args
         (apply string "?" (intersperse '&
                                        (map (fn ((k v))
                                               (string k '= v))
                                             it)))
         ""))
just "string" can be used instead:

  (def reassemble-args (req)
    (aif req!args
         (string "?" (intersperse '&
                                  (map (fn ((k v))
                                         (string k '= v))
                                       it)))
         ""))


1 point by conanite 5277 days ago | link

well spotted :)

-----