I'm still not following what your program does. (Can you describe its inputs and how it transforms them in english?)
I remember you asked a similar question last year: http://arclanguage.org/item?id=19109. Perhaps it would help to connect up how your question here relates to that thread?
Here's how you run the code in that thread for reading lines from a file with anarki:
$ cat x
ab
cd ef
ghi
$ cat x.arc
(write:w/infile file "x"
(drain (readline file)))
$ ./arc x.arc
("ab" "cd ef" "ghi")
#t
Here is a follow on problem as I'm going through the tutorial: obj does not work and the error message seems to access memory not involved with the obj.
arc> (printlst alist)
ARR(1)="PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG"
ARR(2)=" N ARR,FND,I,RSD,RTN,STOP,TXT"
ARR(3)=" W !!,"PASTE""
ARR(4)=" F R !,X:15 Q:'$T S ARR($I(ARR))=X"
ARR(5)=" K RSDS"
""
arc> (= codes (obj "Boston" 'bos "San Francisco" 'sfo "Paris" 'cdg))
Error: "list-ref: contract violation\n expected: exact-nonnegative-integer?\n given: '(((codes (obj \"Boston\" (quote bos . nil) \"San Francisco\" (quote sfo . nil) \"Paris\" (quote cdg . nil) . nil) . nil) . nil))\n argument position: 2nd\n other arguments...:\n '(\"\\nARR(1)=\\\"PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG\\\"\" \"\\nARR(2)=\\\" N ARR,FND,I,RSD,RTN,STOP,TXT\\\"\" \"\\nARR(3)=\\\" W !!,\\\"PASTE\\\"\\\"\" \"\\nARR(4)=\\\" F R !,X:15 Q:'$T S ARR($I(ARR))=X\\\"\" \"\\nARR(5)=\\\" K RSDS\\..."
arc>
Judging by that error message, it looks like the variable "=" or one of its dependencies might have been reassigned somewhere along the line. The second argument in that error message indicates that = is getting hold of your read-in data somehow, so it might be something you've defined for processing this data.
The dependencies of = include expand=list, expand=, map, pair, and setforms (among others), so if any of these has been overwritten, it might do something like what you're seeing.
By the way, I think if you're not using Anarki, there's a known bug in (readline ...) where it will spuriously combine each empty line with the following line (https://sites.google.com/site/arclanguagewiki/arc-3_1/known-...). Maybe this could explain the extra \n you're getting.
Hmm, not sure what happened. Not sure what you mean by memory problems, but I've never seen flakiness in a session this short. Perhaps something in your earlier session was accidentally a control character or something. Keep an eye out for it and I will too.
Here's a full session I tried out on linux:
$ arc
arc> (def printlst (thelist) (if (is thelist nil) (prn "") (do (prn (car thelist)) (printlst (cdr thelist)))))
#<procedure: printlst>
arc> (def readit () (drain (readline (stdin))))
#<procedure: readit>
arc> (= alist (readit))
ARR(1)="PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG"
ARR(2)=" N ARR,FND,I,RSD,RTN,STOP,TXT"
ARR(3)=" W !!,"PASTE""
ARR(4)=" F R !,X:15 Q:'$T S ARR($I(ARR))=X"
ARR(5)=" K RSDS"
("" "ARR(1)=\"PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG\"" "" "ARR(2)=\" N ARR,FND,I,RSD,RTN,STOP,TXT\"" "" "ARR(3)=\" W !!,\"PASTE\"\"" "" "ARR(4)=\" F R !,X:15 Q:'$T S ARR($I(ARR))=X\"" "" "ARR(5)=\" K RSDS\"")
arc> (printlst alist)
ARR(1)="PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG"
ARR(2)=" N ARR,FND,I,RSD,RTN,STOP,TXT"
ARR(3)=" W !!,"PASTE""
ARR(4)=" F R !,X:15 Q:'$T S ARR($I(ARR))=X"
ARR(5)=" K RSDS"
""
arc> (= codes (obj "Boston" 'bos "San Francisco" 'sfo "Paris" 'cdg))
#hash(("Boston" . bos) ("Paris" . cdg) ("San Francisco" . sfo))
arc>
So I tried again with arc running on Racket under Linux. Here's what I found:
arc> (def readit () (drain (readline (stdin))))
#<procedure: readit>
arc> (readit)
ARR(1)="PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG"
ARR(2)=" N ARR,FND,I,RSD,RTN,STOP,TXT"
ARR(3)=" W !!,"PASTE""
ARR(4)=" F R !,X:15 Q:'$T S ARR($I(ARR))=X"
ARR(5)=" K RSDS"
("\nARR(1)=\"PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG\"" "\nARR(2)=\" N ARR,FND,I,RSD,RTN,STOP,TXT\"" "\nARR(3)=\" W !!,\"PASTE\"\"" "\nARR(4)=\" F R !,X:15 Q:'$T S ARR($I(ARR))=X\"" "\nARR(5)=\" K RSDS\"" "\n")
arc> (= alist (readit))
ARR(1)="PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG"
ARR(2)=" N ARR,FND,I,RSD,RTN,STOP,TXT"
ARR(3)=" W !!,"PASTE""
ARR(4)=" F R !,X:15 Q:'$T S ARR($I(ARR))=X"
ARR(5)=" K RSDS"
("\nARR(1)=\"PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG\"" "\nARR(2)=\" N ARR,FND,I,RSD,RTN,STOP,TXT\"" "\nARR(3)=\" W !!,\"PASTE\"\"" "\nARR(4)=\" F R !,X:15 Q:'$T S ARR($I(ARR))=X\"" "\nARR(5)=\" K RSDS\"" "\n")
arc> alist
("\nARR(1)=\"PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG\"" "\nARR(2)=\" N ARR,FND,I,RSD,RTN,STOP,TXT\"" "\nARR(3)=\" W !!,\"PASTE\"\"" "\nARR(4)=\" F R !,X:15 Q:'$T S ARR($I(ARR))=X\"" "\nARR(5)=\" K RSDS\"" "\n")
arc> (len alist)
6
arc> (def printlst (thelist) (if (is thelist nil) (prn "") (do (prn (car thelist)) (printlst (cdr thelist)))))
#<procedure: printlst>
arc> (printlst alist)
ARR(1)="PARSE ; PARSE OUTPUT OF ^%RFIND INTO RSD/RTN/TAG"
ARR(2)=" N ARR,FND,I,RSD,RTN,STOP,TXT"
ARR(3)=" W !!,"PASTE""
ARR(4)=" F R !,X:15 Q:'$T S ARR($I(ARR))=X"
ARR(5)=" K RSDS"
""
arc>
I think the issue with the \n is sending data between Windows and Linux.
I did have to key in Ctrl-D twice to actually get the function to finish reading. Is there a better way to do this?
This probably seems weird, but I capture the data on a Windows system, then e-mail the data to a Linux system which is where arc resides. I assume Windows and Linux have different line endings.
Perhaps I need to check out the community version of arc?
Has anyone figured out a way to compile an arc routine? I saw an earlier thread on it, but no resolution.