(kill(all), load("charsets_flatten.lisp"), 0);
0$

charsets_flatten(3);
3$

charsets_flatten(-3);
-3$

charsets_flatten(2/3);
2/3$

charsets_flatten(-2/3);
-2/3$

charsets_flatten(1.4d2);
1.4d2$

charsets_flatten(-3.4d0);
-3.4d0$

charsets_flatten(x);
x$

charsets_flatten(abc);
abc$

charsets_flatten(%pi);
%pi$

charsets_flatten(rat(x));
x$

charsets_flatten(x[5]);
x[5]$

charsets_flatten(x[8,32]);
x[8,32]$

charsets_flatten(-x);
-x$

charsets_flatten(rat(-x));
-x$

charsets_flatten(a+b);
a+b$

charsets_flatten(rat(a+b));
a+b$

charsets_flatten(a*b);
a*b$

charsets_flatten(a/b);
a/b$

charsets_flatten(a*b*c);
a*b*c$

charsets_flatten(a^b);
a^b$

charsets_flatten(a^(a^b));
a^(a^b)$

charsets_flatten([]);
[]$

charsets_flatten([[]]);
[]$

charsets_flatten([x]);
[x]$

charsets_flatten([[x]]);
[x]$

charsets_flatten(f(g(f(f(x)))));
f(g(f(f(x))))$

charsets_flatten(f(f(g(f(x)))));
f(g(f(x)))$

/* Examples from Macsyma 422 */

charsets_flatten([a,b,[c,[d]],e,[[f],g,h]]);
[a,b,c,d,e,f,g,h]$

charsets_flatten([a,b([c]),[d]]);
[a,b([c]),d]$

charsets_flatten(f(f(a,b), f(c,d)));
f(a,b,c,d)$

charsets_flatten(f[1](f[1](a,b), f[1](c,d)));
f[1](a,b,c,d)$


/* every tests */
charsets_every([]);
false$
charsets_every([false]);
false$
charsets_every([false,false]);
false$
charsets_every(false);
false$
charsets_every(false,false);
false$
charsets_every(true);
true$
charsets_every([true]);
true$
charsets_every([true,true]);
true$
charsets_every(true,true);
true$
charsets_every([true,false]);
false$
charsets_every(true,false);
false$
