Arc Forumnew | comments | leaders | submitlogin
4 points by cchooper 6404 days ago | link | parent

w/ is a convention, short for 'with'.

If you're looking for Arc documentation, then try http://practical-scheme.net/wiliki/arcxref

In particular, the kind of commands you're looking for are:

w/infile (open a file for input, execute some code, and then close it)

w/outfile (same as w/infile but for output)

readc/readb (read a character/byte from an open file)

writec/writeb (write a character/byte to an open file)

Other useful operators are readfile, writefile, drain and w/stdout. Note that most of the Arc functions related to file manipulation assume that the file you're editing is Arc code (e.g. readfile) so watch out for that. I haven't yet found an easy way to read the contents of a file into a string, but the following function works:

  (def loadtext (filename)
    (apply string (w/infile s filename (drain (readc s)))))


2 points by cchooper 6404 days ago | link

Your question has inspired me to do some coding, so I've just posted this to the forum:

http://arclanguage.org/item?id=4220

-----