arc> (extract-arg-names 'xs)
(xs)
arc> (extract-arg-names '(x))
(x)
arc> (extract-arg-names '(a b))
(a b)
arc> (extract-arg-names '(a b (c d)))
(a b c d)
arc> (extract-arg-names '(a b c (d e (f g) (o h "foo")) (o i a) (o j 1)))
(a b c d e f g h i j)
So using 'extract-arg-names instead of 'flat removes the problem of optional args. Use this function whenever you have a macro that needs to manipulate parameter lists!
arc> (def myothermap (f (o xs '(a b c)))
(map f xs))
#<procedure:zz>
arc> (def otherfoo (bar)
(myothermap bar))
#<procedure: otherfoo>
arc> (otherfoo nil)
Error: "error in otherfoo(nil)\nerror in myothermap(nil (a b c))\nFunction call on inappropriate object nil (a)"