transforming a number to a list



Gosse michel wrote:
> Hello
>
> How can i transform a number to list of its digits :
> For instance, 345 -> [3,4,5]
>
> Best regards
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>   
f(x):= if x=0 then [] else cons(remainder(x,10), f(quotient(x,10)));

reverse(f(345))  gives you [3 4 5]

x must be a positive integer for this to work.