This code
(defun arabic_to_roman (filename) (let ((arab_roman_dp '()) (arab nil) (roman nil)) (with-open-file (in filename :direction :input :if-does-not-exist nil) (when in (loop for line = (read-line in nil) while line do (setq arab (subseq line 0 (search "=" line))) (setq roman (subseq line (1+ (search "=" line)) (length line))) (setf arab_roman_dp (acons arab roman arab_roman_dp)) ;(format t "~S ~S~%" arab roman) ))) (with-open-file (stream #p"ar_out.txt" :direction :output :if-exists :overwrite :if-does-not-exist :create ) (write arab_roman_dp :stream stream :escape nil :readably nil)) 'done!)) seems to work well. It takes a file with entries like this
1=I 2=II ... and builds one large list of dotted pairs. However when I look at the output file, it seems as though soft returns or newlines have been inserted.
((4999 . MMMMCMXCIX) (4998 . MMMMCMXCVIII) (4997 . MMMMCMXCVII) (4996 . MMMMCMXCVI) (4995 . MMMMCMXCV) (4994 . MMMMCMXCIV) (4993 . MMMMCMXCIII) (4992 . MMMMCMXCII) (4991 . MMMMCMXCI) (4990 . MMMMCMXC) ... I was expecting the output to look more like just one continuous line:
((4999 . MMMMCMXCIX) (4998 . MMMMCMXCVIII) (4997 . MMMMCMXCVII) (4996 . MMMCMXCVI) (4995 . MMMMCMXCV) (4994 . MMMMCMXCIV) (4993 . MMMMCMXCIII) (4992 . MMMMCMXCII) (4991 . MMMMCMXCI) (4990 . MMMMCMXC) ... Is my code the way it is indeed throwing in newlines somehow? I've used the write version of princ which supposedly suppresses newlines. Later I want to read this file back into the program as just one big list, so I don't want newline issues.