Arc Forumnew | comments | leaders | submitlogin
2 points by jsgrahamus 3320 days ago | link | parent

More interesting answers/questions.

From arc.arc:

  (def read ((o x (stdin)) (o eof nil))
    (if (isa x 'string) (readstring1 x eof) (sread x eof)))

  ; inconsistency between names of readfile[1] and writefile

  (def readfile (name) (w/infile s name (drain (read s))))

  (def readfile1 (name) (w/infile s name (read s)))

  (def readall (src (o eof nil))
    ((afn (i)
      (let x (read i eof)
        (if (is x eof)
            nil
            (cons x (self i)))))
     (if (isa src 'string) (instring src) src)))
===

  Use (quit) to quit, (tl) to return here after an interrupt.
  arc> (def read-all (filename) \
            (w/infile file filename \
                      (drain (readline file))))
  #<procedure: read-all>
  arc> (read-all "c:Log.txt")
  Error: "|_\r|: undefined;\n cannot reference undefined identifier"
  arc> (readfile "c:Log.txt")
  (===== 11:52:29 AM ===== 11:56:49 AM ===== 12:10:19 PM ===== 12:39:31 PM ===== 1:08:54 PM ===== 1:11:19 PM ===== 2:14:21 PM ===== 2:14:33 PM ===== 12:36:29 PM ===== 5:13:08 PM ===== 9:56:43 AM ===== 2:36:16 PM ===== 4:23:45 PM ===== 2:35:41 PM)
  arc> (readfile "c:/users/steve/desktop/mccf.txt")
  Error: "c:/users/steve/desktop/mccf.txt::509: read: bad syntax `# '"
  arc> (readfile "c:\\users\\steve\\desktop\\mccf.txt")
  Error: "c:\\users\\steve\\desktop\\mccf.txt::509: read: bad syntax `# '"
  arc> (readfile1 "c:\\users\\steve\\desktop\\mccf.txt")
  DEVISC1A1:DEVVCC>D
  arc> (readall "c:\\users\\steve\\desktop\\mcc.txt")
  (c:usersstevedesktopmcc.txt)
  arc> (readall "c:/users/steve/desktop/mcc.txt")
  (c:/users/steve/desktop/mcc.txt)
  arc> (readall "c:/users/steve/desktop/mcc.txt" (o))
  Error: "_o: undefined;\n cannot reference undefined identifier"
  arc>