From: Clint Hyde
Subject: RE: manipulating integers as strings
Date: 
Message-ID: <3o3619$noj@info-server.bbn.com>
In article <··········@news.aero.org> ········@Aero.org (David Schulenburg) writes:
--> In article <··········@cnn.Princeton.EDU>, "Ira H. Fuchs" <·····@princeton.edu> writes:
--> |> Can someone tell me how I can take an integer, reverse its digits, and then use
--> |> it as an argument to a function which requires a numeric argument? The function
--> |> which does the reversal should be efficient as it will have to work with
--> |> arbitrarily large integers. I tried converting the integer using the pack
--> |> function (explode) and was then able to use reverse but getting the result back
--> |> to an integer has so far eluded me.
--> |> 
--> 
--> there might be better ways to do this; but, the following will work.
--> 
--> [1c] USER(38): (setq n 12345)
--> 12345
--> [1c] USER(39): (format nil "~a" n)
--> "12345"
--> [1c] USER(40): (nreverse *)
--> "54321"
--> [1c] USER(41): (read-from-string *)
--> 54321


duh. this is appalling simple, and I've never used reverse on strings. I
wonder about the actual internal efficiency of nreverse and its mechanism.

 -- clint