Just and idea - how about including an extended version of remove in arc ? I am sure you guys can work it much better, but I am finding my version really handy: (def remove args
(with (spec (last args)
(val . rest)(rem (last args) args))
(case (type spec)
cons (if (no rest)(rem val spec)(eval `(remove ,@rest ',(rem val spec))))
string (if (no rest)(subst "" val spec)(eval `(remove ,@rest ',(subst "" val spec)))))))
(on a side note: it really bugs me that 'case' doesn't handle types the way other arc functions do - ie shouldn't the type be quoted ? (case (type something) 'cons ... instead of cons ?)anyway back to remove - which allows me to rem multiple items from a list without having to -> (rem this (rem that (from list))) so instead I can: arc> (remove "e" "u" "s" '( "T" "h" "a" "d" "d" "e" "u" "s"))
("T" "h" "a" "d" "d")
and also I use genstring a lot which allows me to coerce lists into strings: (def genstring (options (o endit ""))
(string (trim (if (no options)
nil
(let (val . rest) options
(string val " " (genstring rest)))) 'both) endit))
and so.... arc> (genstring '("T" "h" "a" "d" "d"))
"T h a d d"
then I can go back and use 'remove' on strings as well: arc> (remove " " "T h a d d")
"Thadd"
so to wrap it up you could just do: arc> (remove " " (genstring (remove "e" "u" "s" '( "T" "h" "a" "d" "d" "e" "u" "s"))))
"Thadd"
This one simple example could probably be coded other ways, but I'm finding I use these two functions alot!P.S. Thaddeus is actually my dogs name - lol :) T. [EDIT] - one could just mod genstring to strip out the spaces too, but I tried to keep the genstring function generic enough to reuse in other situation where the space might be required. |