Created
November 22, 2015 14:34
-
-
Save priyadarshan/e6ddc4820f9b7af63595 to your computer and use it in GitHub Desktop.
Read a file containing lines like foo=bar and output to a new file like this (foo . bar)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun arabic_to_roman (filename) | |
(cl-flet ((read-it () | |
(with-open-file (in filename | |
:direction :input | |
:if-does-not-exist nil) | |
(loop for line = (read-line in nil) | |
for pos = (position \= line) | |
while line collect (cons (subseq line 0 pos) | |
(subseq line (1+ pos)))))) | |
(write-it (list) | |
(with-open-file (cl-stream #p"ar_out.txt" | |
:direction :output | |
:if-exists :overwrite | |
:if-does-not-exist :create) | |
(write list :stream stream :escape nil :readably nil :pretty nil)))) | |
(write-it (read-it)) | |
'done-read-write)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment